BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SAS_inquisitive
Lapis Lazuli | Level 10

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;
1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

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).

View solution in original post

1 REPLY 1
FreelanceReinh
Jade | Level 19

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).

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 4752 views
  • 1 like
  • 2 in conversation