DATA Step, Macro, Functions and more

Auto run of the SAS jobs

Accepted Solution Solved
Reply
Contributor
Posts: 68
Accepted Solution

Auto run of the SAS jobs

Hi

 

I used to schedule the SAS codes using windows scheduler. The sas codes are running daily basis from the system.
Now I need to schedule the job only in Monday and Tuesday. And I want to use a logic in macro for running the code in Monday and Tuesadyand disable the other days run .


Accepted Solutions
Solution
‎03-13-2018 07:46 AM
PROC Star
Posts: 229

Re: Auto run of the SAS jobs

Posted in reply to ambadi007

You do not need a macro for that, a simple datastep with an ABORT statement will suffice:

data _null_;
  if weekday(today()) not in(2,3) then
    abort return 0;
run;

If you put that in the top of your program, it will only run on Mondays and Tuesdays.

View solution in original post


All Replies
Super User
Super User
Posts: 9,227

Re: Auto run of the SAS jobs

Posted in reply to ambadi007

You are already using a scheduler:

"windows scheduler"

 

Within that application, there is the functionality to schedule code to run on specific days.  Use that, don't try to re-invent the wheel.

Solution
‎03-13-2018 07:46 AM
PROC Star
Posts: 229

Re: Auto run of the SAS jobs

Posted in reply to ambadi007

You do not need a macro for that, a simple datastep with an ABORT statement will suffice:

data _null_;
  if weekday(today()) not in(2,3) then
    abort return 0;
run;

If you put that in the top of your program, it will only run on Mondays and Tuesdays.

☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 87 views
  • 2 likes
  • 4 in conversation