cklg.pl -- Scan a SAS log for errors, warnings, and other issues


I wrote this Perl program to do a faster scan through one or more SAS log files than I could do by pulling them into an editor and paging through them. The script, on Unix/Linux, can be run on multiple log files. The output is set up to allow the use of the Vim editor's Quick Fix facility. Adding more search terms is easy. Just add them to the @search array like the others.

Usage

Assuming this program is executable, its commandline is: cklg.pl [-h] [-l] [SAS log filename...] where:

As an example, the command cklg testdate2.log might produce output like:

~/sas> cklg testdate2.log
testdate2.log:33:ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, ;, <, <=, <>,
testdate2.log:40:NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
testdate2.log:42:NOTE: The SAS System stopped processing this step because of errors.
testdate2.log:43:WARNING: The data set WORK.TEST2 may be incomplete.  When this step was stopped there were 0
testdate2.log:45:WARNING: Data set WORK.TEST2 was not replaced because this step was stopped.

The -l command line option will list the search terms used by the program. This allows you to see why a certain issue was found in a log or missed in a log search (so you can add it). I haven't added new terms to this list for a long time. Once I put it into use I found most of the common log issues and some uncommon issues. The term "error" catches a lot of issues beyond the usual SAS :ERROR tags in the log. the cklg -l output looks like this:


~/sas> cklg -l

The log search terms used by cklg are: 
   error
   fatal
   warning:
   syntax error
   converted
   uninitialized
    0 obs
   no obser
   [...]
   stopped
   due to loop

29 terms defined.

Back to Kent's Perl Page
Last Modified: Mon Aug 4 09:34:50 EDT 2025