07-05-2017 07:27 AM
We have a sas application which has 15 sas programs and currently each program is being run by a person manually one after the other.
Log data for each program will be saved in a separate text file in local path.
Now, we need to automate the process. So in part of automation, at the end of each sas program we need to check log for any errors before we proceed to next program. process should call 2nd program only when there are no erros in log of first sas pprogram . If there are any errors in log of 1st program, it should not call 2nd program and an email notification should be done stating that there are erros in the log of first program.
Please help me on this.
Thanks in advance.
07-05-2017 07:44 AM
When you run SAS in batch mode, the process will end with a return code of 0 only if no ERRORs or WARNINGs were given.
You can use that return code to chain SAS calls, how you do it depends on the platform on which your SAS is installed and runs.
Once you reach the level of complexity you obviously have reached now, I would also consider attaching the SAS processing to the organisation's scheduling system. Schedulers are the best tool for running jobs the way you intend to.
07-05-2017 10:19 AM
I will run each program between rsubmit and endrsubmit in base sas 9.4 editor. here each program is lengthy which consists multiple datasets. so now once program 1 completey runs, we need to validate whether there are any errors from entire program 1 or not. it should call program 2 only if there are no errors found else it should stop and send en email notification saying there are errors found in step 1. This process loop should go on for all steps. Error check in log is the condition that we should add as dependency between each program.
what is the best way to implement this. Please suggest. can we write any macro to do this.. suggestions please.
Note: Scheduler will be used just to kick off the entire sas program. what I am thinking is put code from all sas programs in a single sas program and between each program code we need to incorporate code to check the errors in Log along with any other conditions that we have.
07-05-2017 01:38 PM