SYSERRORTEXT Automatic Macro Variable

Contains the text of the last error message formatted for display in the SAS log.
Type: Automatic macro variable (read only)

Details

The value of SYSERRORTEXT is the text of the last error message generated in the SAS log. For a list of SYSERR warnings and errors, see SYSERR Automatic Macro Variable.
Note: If the last error message text that was generated contains an & or % and you are using the %PUT statement, you must use the %SUPERQ macro quoting function to mask the special characters to prevent further resolution of the value. The following example uses the %PUT statement and the %SUPERQ macro quoting function:
%put %superq(syserrortext);
For more information, see %SUPERQ Function.

Example: Using SYSERRORTEXT

This example creates an error message:
data NULL;
   set doesnotexist;
run;
%put &syserrortext;
When these statements are executed, the following record is written to the SAS log:
1   data NULL;
2   set doesnotexist;
ERROR: File WORK.DOESNOTEXIST.DATA does not exist.
3   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.
NOTE: DATA statement used (Total process time):
real time       11.16 seconds
cpu time        0.07 seconds
4  %put &syserrortext;
File WORK.DOESNOTEXIST.DATA does not exist.