Is there a way to make SAS stop upon the first warning or error?

后端 未结 5 1655
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 01:44

SAS likes to continue processing well after warnings and errors, so I often need to scroll back through pages in the log to find an issue. Is there a better way? I\'d like

5条回答
  •  暖寄归人
    2020-12-03 01:57

    The ERRORS=1 option was previously suggested, but that only stops he ERROR messages from writing to the log. I would suggest another system option ERRORABEND which will stop the program from further processing for most errors. I don't know of an option to terminate processing due to warnings, but I think that you could add a macro like the following to stop processing.

    %macro check_for_errors;
       %if &syserr > 0 %then %do;
          endsas;
       %end;
    %mend check_for_errors;
    
    data test1;
        
    run;
    %check_for_errors;
    

    You could repeat the macro call after each step of your program, and it should terminate at the point that the error code is anything but 0.

提交回复
热议问题