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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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