Return Codes and Completion Status

The return code for the completion of a SAS job is returned in the Windows batch variable, ERRORLEVEL. A value of 0 indicates normal termination. You can affect the value of ERRORLEVEL by using the ABORT statement. The ABORT statement takes an option argument, n, which is an integer. The ABORT statement also takes the RETURN or ABEND argument. If you issue these statements without specifying n, the ERRORLEVEL variable is set to the following values:
abort;
sets the ERRORLEVEL variable to 3.
abort return;
sets the ERRORLEVEL variable to 4.
abort abend;
sets the ERRORLEVEL variable to 5.
The n argument can range from 1 to 65,535. The ERRORLEVEL variable is used as a condition in the IF command in a Windows batch file. Refer to your Window's user's guide for more information about the ERRORLEVEL variable. The following table summarizes the values of the ERRORLEVEL variable.
Note: To check the ERRORLEVEL variable, start SAS using the START/ WAIT command. From a DOS window enter:
start/wait "title" "C:\Program Files\SASHome\SASFoundation\9.4\sas.exe"
Values for the ERRORLEVEL Variable
Condition
Severity
Return Code Value
All steps terminated normally
SUCCESS
0
SAS issued warning(s)
WARNING
1
SAS issued error(s)
ERROR
2
User issued the ABORT statement
INFORMATIONAL
3
User issued the ABORT RETURN statement
FATAL
4
User issued the ABORT ABEND statement
FATAL
5
SAS internal error
INFORMATIONAL
6