BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hey,

Do you guys know how to schedule to run a SAS program? For eg: say I want a particular code to run at Sunday morning 10:00 AM. How do I do that...?

Regards,
Shalini
9 REPLIES 9
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
What OS platform? There are several technical reference papers on the SAS support http://support.sas.com/ website that discuss this topic for various OS environments.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Hi,

Traduce :

Tu peux créer une tâche planifiée en cliquant sur :

démarrer => panneau de configuration => tâche planifiée => création d'une tâche planifiée

Je ne sais pas si ton PC est conçu pareil...

Bye
Doc_Duke
Rhodochrosite | Level 12
Depends on your platform.

In Unix, use the AT command for a one-off schedule or the CRON tool for a repeating schedule.

In Windows, use the Windows Scheduler (available from the control panel).

In both, you have to know the syntax to run a SAS job in batch from the command line. Many Unix admins have written local scripts so batch jobs are easy to set up. In Windows, you have to put the options in yourself, so I usually develop the script in a Windows batch file (.bat extension) and then point the scheduler to the batch file.

My mainframe use is too rusty to give you pointers, beyond that it can be done there too.
Doc_Duke
Rhodochrosite | Level 12
Shalini,

One other note. If you are using Windows and don't see the "Scheduled Tasks" in the Control Panel, that means that your network admins have disabled it and you'll need to contact them to get it back.

Doc
DanielSantos
Barite | Level 11
Hello.

As previously said, adding the task to the system scheduler would be the simplest and safest way.

But, if you wish to run your SAS program from a workstation and lets say, its a one time run only, I guess you could prepare a "special" datastep at the beginning of the program that will wait until the desired hour.

Something like this:

data _null_;
do until(datetime() gt '19APR2009 10:00:00'dt); /* check date/time */
call sleep(10,60); /* wait 10x60 seconds = 10mins until next check */
end;
run;

/* your code, here */

Greetings from Portugal.

Daniel Santos at www.cgd.pt
data_null__
Jade | Level 19
Try wakeup for a more direct solution

[pre]
data _null_;
rc = wakeup('08:47't);
run;
[/pre]
deleted_user
Not applicable
So if I include the date and the time... this is how it should be right ?

**************************************************
data _null_;
rc = wakeup('20APR2009 08:47:00'dt);
run;
**************************************************
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Yes.

Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
However, again, you never replied with OS information - this function is not implemented on the IBM z/OS MVS (mainframe) SAS environment - so it's OS-platform dependent.

Scott Barry
SBBWorks, Inc.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 2548 views
  • 0 likes
  • 5 in conversation