I save this perl program as a file named logsasparse in a directory in my path, and I call it by saying
logsasparse mysasfile.logThe code itself is below:
#!/usr/bin/perl foreach my $ARG( @ARGV) { open(FH, "<$ARG") || die "$ARG inaccessible: $!"; while(<FH>) { print $ARG," :", $., " ", $_ if /(not found|multiple lengths|has more than one data set with|overwrit|uninit|warning|no observations|[^_](?<!set )error(?! detection))/i; } close FH; }
Particularly insidious errors this catches are when a variable is uninitialized, when a variable is overwritten in a merge, and when a data step merge is many-to-many without your realizing it. These errors are insidious because they are not reported as errors in the log, merely notes or warnings.
As a matter of course, you should have the option MSGLEVEL set to I. See Section 9.3 for details.
One nonobvious thing about this way of doing things is that if you create datasets named ERROR, which, if your program is working correctly, will have zero observations, logsasparse will print out how many observations they contain to the log file.