Previous Page | Next Page

Automatic Macro Variables

SYSERR Automatic Macro Variable



Contains a return code status set by some SAS procedures and the DATA step.
Type: Automatic macro variable (read only)

Details
Example
Using SYSERR

Details

You can use the value of SYSERR as a condition to determine further action to take or to decide which parts of a SAS program to execute. SYSERR is used to detect major system errors, such as out of memory or failure of the component system when used in some procedures and DATA steps. SYSERR automatic macro variable is reset at each step boundary. For the return code of a complete job, see SYSCC Automatic Macro Variable.

SYSERR can contain the following values:

Value Description
0 Execution completed successfully and without warning messages.
1 Execution was canceled by a user with a RUN CANCEL statement.
2 Execution was canceled by a user with an ATTN or BREAK command.
3 An error in a program run in batch or non-interactive mode caused SAS to enter syntax-check mode.
4 Execution completed successfully but with warning messages.
5 Execution was canceled by a user with an ABORT CANCEL statement.
6 Execution was canceled by a user with an ABORT CANCEL FILE statement.
>6 An error occurred. The value returned is procedure-dependent.

The following table contains warning return codes. The codes do not indicate any specific problems. These codes are guidelines to identify the nature of a problem.

Warning Code Description
108 Problem with one or more BY groups
112 Error with one or more BY groups
116 Memory problems with one or more BY groups
120 I/O problems with one or more BY groups

The following table contains error return codes. The codes do not indicate any specific problems. These codes are guidelines to identify the nature of a problem.

Error Code Description
1008 General data problem
1012 General error condition
1016 Out-of-memory condition
1020 I/O problem
2000 Semantic action problem
2001 Attribute processing problem
3000 Syntax error
4000 Not a valid procedure
9999 Bug in the procedure
20000 A step was stopped or an ABORT statement was issued.
20001 An ABORT RETURN statement was issued.
20002 An ABORT ABEND statement was issued.
25000 Severe system error. The system cannot initialize or continue.


Example


Example 1: Using SYSERR

The example creates an error message and uses %PUT &SYSERR to write the return code number (1012) to the SAS log.

data NULL;
   set doesnotexist;

run;  

%put &syserr;

The following SAS log output contains the return code number:

75   data NULL;
76      set doesnotexist;
ERROR: File WORK.DOESNOTEXIST.DATA does not exist.
77
78   run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.NULL might be incomplete.  When this step was stopped 
there were 0 observations and 0 variables. WARNING: Data set WORK.NULL was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 79 80 %put &syserr; 1012

To retrieve error and warning text instead of the return code number, see SYSERRORTEXT Automatic Macro Variable and SYSWARNINGTEXT Automatic Macro Variable.

Previous Page | Next Page | Top of Page