I was trying to include some system automatic variables (syserr or syscc) to get some error meaages. I wonder which is appropriate to capture error mesages and what is the difference between them?
data test; set sashelp.class; run; %put &syscc; data test; set sashelp.class; run; %put &syserr;
Hi @SAS_inquisitive,
Neither of these two captures error messages (in words). For error messages please see SYSERRORTEXT (and for warning messages SYSWARNINGTEXT).
In SYSCC and SYSERR you will find only codes, e.g. 1012. The difference between them is that SYSERR refers to the most recent DATA or PROC step (for some procedures), whereas SYSCC refers to the entire SAS session.
As a consequence, SYSERR is reset to 0 (the code for "Execution completed successfully and without warning messages" [see documentation]) after a step was completed successfully, but SYSCC would still contain the error code it received possibly many steps earlier. Also, SYSCC is not restricted to DATA and ("some") PROC steps, but captures errors also, e.g., in global statements such as an OPTIONS statement. SYSERR, however, would not change after such a statement (whether successful or not).
Hi @SAS_inquisitive,
Neither of these two captures error messages (in words). For error messages please see SYSERRORTEXT (and for warning messages SYSWARNINGTEXT).
In SYSCC and SYSERR you will find only codes, e.g. 1012. The difference between them is that SYSERR refers to the most recent DATA or PROC step (for some procedures), whereas SYSCC refers to the entire SAS session.
As a consequence, SYSERR is reset to 0 (the code for "Execution completed successfully and without warning messages" [see documentation]) after a step was completed successfully, but SYSCC would still contain the error code it received possibly many steps earlier. Also, SYSCC is not restricted to DATA and ("some") PROC steps, but captures errors also, e.g., in global statements such as an OPTIONS statement. SYSERR, however, would not change after such a statement (whether successful or not).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: