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

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!

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.

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
  • 2 replies
  • 2192 views
  • 0 likes
  • 3 in conversation