How can I create an automated error report from the log?
Is there a simple macro solution to capture this information? On our team, we have drafted a template macro but it is not pulling all the errors from the run only the last error. Also at times the errors are not noticed at all by the macro. Example below
I would like to receive an email when the SAS program encounters an error. The email should include the # of errors, program name and list of errors. Are there any other fields that would return the errors or error count or text for each error?
/*MACRO TO PRINT ERRS AND SEND EMAIL*/
%MACRO TEST();
%IF &SYSERR EQ 0 %THEN %DO;
%PUT NOERROR;
%END;
%ELSE %DO;
filename outbox email cc=("email@email.com")
subject="XXX &SYSDATE9. Error in program &_CLIENTTASKLABEL."
type="text/html";
ods html3 body = outbox style=Minimal;
ods html3 text="&_CLIENTPROJECTPATH.";
ODS HTML3 TEXT="&_CLIENTPROCESSFLOWNAME., &_CLIENTPROJECTNAME";
ods html3 text="SYSERRS: &SYSERR.";
ods html3 text="SYSERRTEXT: &SYSERRORTEXT.";
ODS HTML3 TEXT="SYSDBMSG: &SYSDBMSG.";
ODS HTML3 TEXT="SYSLAST: &SYSLAST.";
title;
footnote;
ods html3 close;
ods msoffice2k close;
%END;
%MEND;
%TEST();