Hi
I ahve to execute a batch scripts(sh script) which calls a SAS job inside a macro, I have to check the return code of the same . How to do ?
%do i=1 to &max;/*Max holds 9 thats 9 jobs*/
%let path = /app/jobs;
x "&path/&&jobs&i...&extn";/*extn is sh*/
%if rc ge 0 /*I have to do this but unabel to get rc value*/
Kindly advise
Thanks,
Sandhya S
Since included code is always executed in the context of your local SAS, check &syscc for the current return code status.
You should also read through the documentation of the other automatic macro variables.
First of all you need to make sure that the shell script returns the RC from SAS. After executing an external command, check the &sysrc automatic macro variable. It contains the return code from the x statement.
For reference, see here: http://documentation.sas.com/?docsetId=mcrolref&docsetTarget=p07ugdul4v0llpn1denhfknmr7sb.htm&docset...
Since included code is always executed in the context of your local SAS, check &syscc for the current return code status.
You should also read through the documentation of the other automatic macro variables.
Not sure what you mean by "Job" in this context.
For the "calling" session there will be a rc of course, but the included code is not a job.
If you want to monitor individual steps you can check rc for these.
If I try to read between the lines, I think you want to monitor each program separately, and the %include's are not a good choice.
Better to set job flows up in a decent scheduler, and have that as a central point of control.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.