Help using Base SAS procedures

Forcing a SAS error state

Reply
Regular Learner
Posts: 1

Forcing a SAS error state

I'm trying to figure out how to trigger a SAS code "error" when I run a X command that has an error return code.

I am running a Unix script in my sas code. If the Unix script fails, there is no warning, and Enterprise Guide keeps processing the sas code. I am able to capture the return code of the script by referencing the macro variable &sysrc. I'm not sure how to force Enterprise Guide to trigger an error state based on the &sysrc code from the Unix script. I would like Enterprise Guide to throw an error similar to the type of error when a data step bombs.

I am thinking that there may be a way to re-assign the SASERR macro variable to my own value, but I'm not sure how to do it.

Thanks!
Occasional Contributor
Posts: 5

Re: Forcing a SAS error state

"there may be a way to re-assign the SASERR macro variable to my own value". I don't use EG much, but in code I would write %let _sysrc=&sysrc; to capture the error return code and then use &_sysrc to check the error condition. You can do the same thing with &syserr. Good luck.
N/A
Posts: 0

Re: Forcing a SAS error state

another route : use call execute() to conditionally generate a syntax error condition. Perhaps this might work/fail adequately [pre]DATA _NULL_ ;
if ( conditions like &_sysrc that determine task failure) then
CALL EXECUTE( 'data 123; run;' ) ;
run ;[/pre]
PeterC
Ask a Question
Discussion stats
  • 2 replies
  • 296 views
  • 0 likes
  • 3 in conversation