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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4700 views
  • 1 like
  • 2 in conversation