Production SAS code should be free of errors warnings and not contain certain notes as these indicate that the code may have logic errors.  The logscan macro will check for a series of terms in the logfile and will write a message to the SAS log showing the
line with the suspect code.

The search terms are in a SAS Dataset defined by the macro variable paramdata e,g joblog.search_parms this contains a single variable chkword examples of which are below

chkword
missing value
warning
uninitialized
converted to
repeats of by
one w.d forma
division by z
error

Additional words can be added as necessary.
If SAS finds a log line containing any of the chkword values it outputs a log message and adds a row to the dataset defined by the outdatf macro variable(The entire log is written to the dataset defined in the outall macro variable);

All records in the &outdatf are then appended to a dataset joblog.suspect_list (This can be customised as required)

This macro is called automatically by the %batch_run macro which uses systask this also returns a system return code gt zero if SAS detects an error or warning.

%macro logscan(logfile=,paramdata=%str(joblog.search_parms),
chk_word=chkword,outall=logscan,outdatf=log_error);
filename indata  "&logfile";
%if %sysfunc(fileref(indata))= 0 %then %do;
data &outall(keep=log_name_full lineno text)  &outdatf(keep=log_name_full log_name runtime lineno chk text);
infile indata missover ;
length log_name_full  text chk $250 log_name $40 runtime $20 ;
input;
text=_infile_;
log_name_full="&logfile";
log_name=scan(log_name_full,-1,'\');
runtime=put(datetime(),datetime20.);
lineno=_N_;
dsid=open("&paramdata");
if dsid >0 then do;
do while (fetch(dsid)=0);
  chk=getvarc(dsid,varnum(dsid,"&chk_word"));
  if (chk='error' and substr(lowcase(text),1,5)='error') or
     (chk='warning' and substr(lowcase(text),1,7)='warning') or
     (chk not in ('error','warning') and find(lowcase(text),strip(chk))) then do;
          output &outdatf.;    
          put '--------------------------------------------------------';
          put 'Log File ' log_name_full 'Line no ' lineno 'Code ' text;
  put '--------------------------------------------------------';
  end;
  end;
dsid=close(dsid);
end;
output &outall;
run;
proc append data=&outdatf base=joblog.suspect_list;
run;
%end;
%mend;