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
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.
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:
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. |
@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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.