DATA Step, Macro, Functions and more

Automating SAS: halt code execution at a specified time

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 92
Accepted Solution

Automating SAS: halt code execution at a specified time

Hello,

What's the most efficient way to stop executing a fairly involved program at a specified time?  For example if I have a program with several macros and data steps would I use a batch command to stop the code at 7am PST?  Or is there an easy way to use a time parameter within SAS that would apply to the entire program (E.g. DO UNTIL loop)?  Any help or advice would be greatly appreciated.  Thank you!

Regards,

Bill


Accepted Solutions
Solution
‎06-26-2013 05:44 AM
PROC Star
Posts: 1,566

Re: Automating SAS: halt code execution at a specified time

If the job is scheduled, you can set the scheduler to kill the job if whatever time condition you choose is met.

Otherwise, both the options you mention are valid.

The batch job has the advantage that you can choose the exact kill time.

Doing it as part of the program means the program has to wait between steps to check, which means:

1) you cannot be certain when a check will be made

2) if a step doesn't complete (infinite loop, processing too slow, bug) the check will never take place.

View solution in original post


All Replies
Super User
Posts: 9,687

Re: Automating SAS: halt code execution at a specified time

function :  SLEEP() ?

Solution
‎06-26-2013 05:44 AM
PROC Star
Posts: 1,566

Re: Automating SAS: halt code execution at a specified time

If the job is scheduled, you can set the scheduler to kill the job if whatever time condition you choose is met.

Otherwise, both the options you mention are valid.

The batch job has the advantage that you can choose the exact kill time.

Doing it as part of the program means the program has to wait between steps to check, which means:

1) you cannot be certain when a check will be made

2) if a step doesn't complete (infinite loop, processing too slow, bug) the check will never take place.

Frequent Contributor
Posts: 92

Re: Automating SAS: halt code execution at a specified time

KSharp and Chris:  Thanks for the suggestions.  I'll kill the job via batch command.  This seems to be the most efficient method.

Regards,

Bill

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 273 views
  • 4 likes
  • 3 in conversation