ODS statements do not trigger SYSERR or SYSCC


If an option is incorrectly specified in an ODS statement and an error or warning message is generated by that statement, the global macro variables SYSERR and SYSCC are not incremented.

The ODS statements are global statements, and therefore do not trigger SYSERR and SYSCC.

Currently, the best way to ensure that a file is correctly created by an ODS statement is to use the FILEEXIST function in conjunction with %SYSFUNC. For example:

 %macro checkit(filename);
      ods pdf file=&filename;
      %put &syserr;
      proc print;
      run;
      ods pdf close;
      %put &syscc;

      %if %sysfunc(fileexist(&filename))=0 %then %do;
         %put THERE WAS A PROBLEM CREATING THIS FILE: &FILENAME;
      %end;

   %mend checkit;

   options mprint mlogic;
   %checkit(test)