BookmarkSubscribeRSS Feed
zdassu
Quartz | Level 8

Hi I was hoping if someone could help me, I have inheritted a process from one of my colleagues that has now left the business, I have to run a program on a monthly basis. this program is a mixture of Data Steps and Proc SQL code and usually takes about 8 hours to complete. Sometimes errors occur and is recorded in the log, when this happens i have to re-run the whole program again. Is there anyway that I can make SAS stop running the program when an error occurs so i can restart it from the point of failure. Your help in this matter would be much appreciated

3 REPLIES 3
Kurt_Bremser
Super User

Dissect the code into smaller pieces that are run by the scheduler in succession; make them dependent, so that a job can only start when the previous job ended successfully.

ballardw
Super User

One of the options would be to set the system option ERRORABEND.

You could add the statement

 

Options errorabend;

at the start of the program.

From the documentation:

ERRORABEND

specifies that SAS terminate for most errors (including syntax errors and file not found errors) that would normally cause it to issue an error message, set OBS=0, and go into syntax-check mode (if syntax checking is enabled). SAS also terminates if an error occurs in any global statement other than the LIBNAME and FILENAME statements.

Tip Use the ERRORABEND system option with SAS production programs, which presumably should not encounter any errors. If errors are encountered and ERRORABEND is in effect, SAS brings the errors to your attention immediately by terminating. ERRORABEND does not affect how SAS handles notes such as invalid data messages.
 
This option may work better in a batch job where the log is preserved.
data_null__
Jade | Level 19

@zdassu wrote:

Hi I was hoping if someone could help me, I have inheritted a process from one of my colleagues that has now left the business, I have to run a program on a monthly basis. this program is a mixture of Data Steps and Proc SQL code and usually takes about 8 hours to complete. Sometimes errors occur and is recorded in the log, when this happens i have to re-run the whole program again. Is there anyway that I can make SAS stop running the program when an error occurs so i can restart it from the point of failure. Your help in this matter would be much appreciated


8 hours Lordy! I would look to improve performance of the existing program, it is usually not very hard make modifications that greatly improve overall performance.  Often times a long running program is rather naively written, ADAM.ADLB in Pharma for example.   

 

SAS has facilities for checkpoint restarting but I have no experience using those.  It would be nice if someone from SAS or other user could provide an example, or reference to paper or blog post.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 606 views
  • 2 likes
  • 4 in conversation