DATA Step, Macro, Functions and more

Arguments of ABORT statement

Regular Contributor
Posts: 234

Arguments of ABORT statement

I was trying to understand the different arguments the ABORT statment.  One of many arguments is interger(n).  What is the purpose of that number. An example would be helpful to understand.

Super Contributor
Posts: 490

Re: Arguments of ABORT statement

Super User
Posts: 17,905

Re: Arguments of ABORT statement

@SAS_inquisitive What does the documentation say about n? And what part is unclear to you. It's worth knowing as the documentation should be accessible and easy to navigate. If it's not, that an issue. 

Super User
Posts: 6,963

Re: Arguments of ABORT statement

Quite simple. The <n> argument determines the exit condition that is handed back to the operating system once the SAS process has terminated.

This allows specific failure conditions that you detected during processing being treated correctly by the invoking shell script/batch file/scheduler/whatever.




In some cases, we want to specifically detect if a certain table has a given minimum of records, and if not, signal that by passing 4 as the exit code:

data somelib.someset;
infile our_in end=done;
* input statements;
if done and _n_ < &minimum_rec then abort abend 4;

Now the envoking script (after detecting that SAS exited with code 4) can set a special condition that lets the scheduling software trigger another job that sends an alarm email with the detailed information that not enough data was provided

Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation