BookmarkSubscribeRSS Feed
gyambqt
Obsidian | Level 7

I am wondering how do you stop DI processing if there is an error within the loop start and loop end.

 

For example:

my DI jobs like below:

 

table1--->loop start--->job1--->job2--->jobN---->loop end

 

table1 is used to pass parameters to job1 for processing

 

however I found even job1 result any error it will not stop the loop which means job2 ...Job3....JobN still gets executed.

 

my question is how do you stop loop processing immediately if any of the middle jobs failed? 

3 REPLIES 3
Patrick
Opal | Level 21

If you run your inner jobs in parallel then each of these jobs will execute in its own (child) SAS session independently. The outer (parent) job then waits for its children to complete before it continues with any further processing.

For this reason you can only stop the outer (parent) job once it receives the error codes from one of the inner jobs but you can't kill already running inner jobs when one of them returns an error code.

 

If I remember right then you can define how many inner jobs to run in parallel. I guess what that means is that when one of the inner job completes then the outer job will "check" if there are remaining inner jobs to execute - meaning in this situation control is given back to the outer job. I don't know if in this scenario the outer job always does some error checking and would abort if the inner job fails - you would have to test or dig into the not that easily to read generated code to get the answer.

 

In the code it's the WAITFOR statement that does the synchronization between outer job and inner job and it's RSUBMIT that spawns the child processes. Which code exactly get executed will also depends if you're running in a SAS Grid environment or not.

gyambqt
Obsidian | Level 7
The parallel option of the loop was not enabled. It is pretty much running and passing parameter one by one. Even though, the loop is still running even it hits an error
Patrick
Opal | Level 21

Then it looks like the error checking is only happening once all the inner jobs have been processed. 

I'm not aware of any selection that would allow you to change this behavior. You would need to look into the generated code to really fully understand what's going on and if there is any option to get what you want.

SAS Innovate 2025: Register Now

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1083 views
  • 1 like
  • 2 in conversation