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

后端 未结 5 1661
爱一瞬间的悲伤
爱一瞬间的悲伤 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 02:08

    I've been using the %runquit macro recently. Works well for both batch jobs and interactive sessions (doesn't close your session, just stops running the code).

    Source: http://www.cpc.unc.edu/research/tools/data_analysis/sas_to_stata/sas-macros/runquit.html

    To use it you basically type %runquit; at the end of any data step or PROC instead of typing your regular run or quit statement.

    Code:

    %macro runquit;
      ; run; quit;
      %if &syserr. ne 0 %then %do;
         %abort cancel;
      %end;
    %mend runquit;
    

    Datastep usage:

    data something; 
     * do some stuff;
    %runquit;
    

    PROC usage:

    proc sql; 
      * do some stuff;
    %runquit;
    

    It's not quite as pretty when reading through code, but it does make debugging a lot easier.

提交回复
热议问题