BookmarkSubscribeRSS Feed
Hari2
Quartz | Level 8

Hi All,

 

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.

 

Thanks,

Hari.

3 REPLIES 3
Kurt_Bremser
Super User

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.

Hari2
Quartz | Level 8

Hi ,

 

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.

Sven111
Pyrite | Level 9
If you don't have or can't use a scheduler to do the checks you want, I'd suggest putting everything in a shell script. That way you can use that to check all of the conditions and then execute the desired follow up code.

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!

How to Concatenate Values

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.

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