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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.