Stop SAS program on error

I use a macro to stop my SAS program on error, but it always disconnects from the server, and then I can no longer return my temporary datasets.

I tried:

OPTIONS ERRORABEND;

Here is the macro I tried:

%macro errchk;
%if &syserr >0 and &syserr ne 4 %then %abort;
%mend errchk;

After reaching this error, the processing of the following data steps is performed.

I cannot figure out how to stop the rest of the program, but DO NOT disconnect from the SAS server. Any ideas?

+5
source share
2 answers

Have you tried using% goto? Instead of causing an interrupt, you can redirect your macro to the exit point and print something in the log to indicate which part of your code failed.

An example syntax is given below:

http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000209058.htm

, % errchk , , , % abort % errchk. % abort calls , , . - , % abort , % errchk - , % nrstr()? , - .

+1

All Articles