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).
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.