BookmarkSubscribeRSS Feed
snkfischer
Calcite | Level 5
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!
2 REPLIES 2
bentleyj
Calcite | Level 5
"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.
deleted_user
Not applicable
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
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2950 views
  • 0 likes
  • 3 in conversation