DATA Step, Macro, Functions and more

system automatic variables

Accepted Solution Solved
Reply
Super Contributor
Posts: 271
Accepted Solution

system automatic variables

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;

Accepted Solutions
Solution
‎02-25-2016 04:32 PM
Trusted Advisor
Posts: 1,117

Re: system automatic variables

Posted in reply to SAS_inquisitive

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


All Replies
Solution
‎02-25-2016 04:32 PM
Trusted Advisor
Posts: 1,117

Re: system automatic variables

Posted in reply to SAS_inquisitive

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

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 301 views
  • 0 likes
  • 2 in conversation