BookmarkSubscribeRSS Feed
DOBBINHO
Obsidian | Level 7

I have been working on an experimental code to schedule a job in sas without using unix. The code is as follows:

%macro incrementvar(vartoincrement);

%let &vartoincrement = %eval(&&&vartoincrement + 86400);

%mend;

%macro chronjb;

data _null_;

now=datetime();

start='07NOV2017:04:35:00'dt;

wait_sec=0;

%mid: wait_sec=%sysfunc(ABS(wait_sec-(start-now)));

      zzz=sleep((wait_sec),1);

      %include 'V2D.sas';

%incrementvar(wait_sec);

%goto mid;

run;

%mend;

%chronjb;

%put &=wait_sec;

 

But it has come to me now that there has been a big issue all along. On running this program, it executes the included program after the required amount of wait time, after which it goes on a never ending loop without waiting for a day. I want the included program to execute at a specific time and keep repeating at that very same time everyday till we stop it. How do I include this way to stop the program, and how do I make it repeat at the same time everyday? Please advice...

5 REPLIES 5
DOBBINHO
Obsidian | Level 7

Note: I know I could try using the "break" and "Window" option to try and specify if I want to continue the loop..... But how do I do so?

 

SASKiwi
PROC Star

Curious to know why you are trying to create your own scheduler in SAS when there are more functional OS, SAS-supplied and third party schedulers available. I would check out what schedulers are already being used in your organisation. Also scheduling is available in SAS using SAS Management Console.

DOBBINHO
Obsidian | Level 7

Your curiosity is totally agreeable, but I actually want to be able to not use any external schedulers since it would be cool to find an alternative. The sleep function is a great yet cumbersome way to do so, but I kinda figured that it would probably be the only way, provided I can debug the program I made.

LinusH
Tourmaline | Level 20

So you have someone that pays you to do cool but totally unnecessary stuff?

Data never sleeps
DOBBINHO
Obsidian | Level 7
lol..... yeah.... pretty neat huh?

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 1011 views
  • 4 likes
  • 3 in conversation