Discussion:
Run a SAS program automatically
(too old to reply)
Mindy Diaz
2003-10-10 14:30:24 UTC
Permalink
Hi,

I have a simple SAS program. I wish it can run automatically everyday
at 12:00 A.M. My system is Windows.

Thanks.

Mindy
Richard Thornton
2003-10-10 16:53:12 UTC
Permalink
Windows has something called AT scheduler. It is DOS based. This
will work for you.
Post by Mindy Diaz
Hi,
I have a simple SAS program. I wish it can run automatically everyday
at 12:00 A.M. My system is Windows.
Thanks.
Mindy
West Addison
2003-10-11 12:22:23 UTC
Permalink
As Richard mentioned, using the DOS "at" command will work. However,
newer versions of Windows have a wizard that will guide you through
the process. From the Windows Control Panel (accessible from the
Start menu or the folders in Explorer/My Computer) select Scheduled
Tasks (in Category View in Windows XP it's under Performance and
Maintenance) and then double click on Add Scheduled Task. On the last
screen of the wizard you'll want to check the box to open the advanced
properties when you click finish. In the Run box of the properties
you'll need to add the path and file name of your SAS program after
sas.exe (which the wizard filled in).
Post by Richard Thornton
Windows has something called AT scheduler. It is DOS based. This
will work for you.
Post by Mindy Diaz
Hi,
I have a simple SAS program. I wish it can run automatically everyday
at 12:00 A.M. My system is Windows.
Thanks.
Mindy
Arto Raiskio
2003-10-13 15:27:28 UTC
Permalink
Post by West Addison
newer versions of Windows have a wizard that will guide you through
the command in the wizard will initially accept only the path to sas.exe and
must be modified to actually run a sas program

so, if sas is installed for example in c:\sas\ then the wizard will accept
initially only the command to execute as c:\sas\sas.exe

after the schedule has been created modify the command to state the module
name, so the entire line will look like
c:\sas\sas.exe c:\sas\myfiles\mytabulate.sas -icon -nosplash -RSasUser
Real SAS User
2003-10-12 15:20:40 UTC
Permalink
Post by Mindy Diaz
Hi,
I have a simple SAS program. I wish it can run automatically everyday
at 12:00 A.M. My system is Windows.
Or in addition to the suggestions to date: instal Cygwin
(http://www.cygwin.com/) to get the full power of cron, including
mailing output or a process summary to a specified address.

--
Charming man. I wish I had a daughter so I could forbid her to marry one...
rpresley
2003-10-16 14:11:08 UTC
Permalink
Mindy,

Below is production code whih I use to run a SAS program every night. The
key is the use of the SAS function "WAKE". This function will cause the SAS
system to sit quietly until the specified time. In this particual program I
use a macro to cause the code to loop 30 times. With the windows operating
system I find it necessary to shut down and restart the computer once a week
or so. Therefore the loop of 30 is plenty for my purposes. If you have
quesitons feel free to contact me directly.

Rodney



/* Titlle: Copy MHN tables to SAS */
/* Programmer: R. Presley */
/* Initial: 5/17/03 */
/* modified: 6/13/03 call program status_soruce.sas
*/
/* Use the SAS wakeup function to execute a program at
specified date and time. This program executes system commands to
execute DBMS Copy programs which copy select Oracle tables to SAS */
/* ********************************** */
/* modified 6/18/03 by R.Presley to make a macro that will run each day
*/
** macro AUTO_RPT will run every day and then update the value of WAKE
by one day
**;
filename st_rpt 'g:\acs\status_source.sas';
libname mhn 'd:\temp\prod' ;
** set wakeup value each day at 9:00 pm
**;
%macro auto_rpt;
%do i=1 %to 30 ;
%if &i=1 %then %do;
data _null_;
** wake=dhms(today(),10,25,00);
wake=dhms(today(),21,30,00);
wake_f=put(wake,datetime16.);
call symput ('wake',wake);
call symput ('wake_f', wake_f);
%runn;
%put "The value of wake is &wake.";
%put "The formatted value of wake is &wake_f.";
%end;
%else %do;
data _null_;
wake=&wake + 60*60*24;
wake_f=put(wake,datetime16.);
call symput ('wake',wake);
call symput ('wake_f', wake_f);
%runn;
%put "The value of wake is &wake.";
%put "The formatted value of wake is
&wake_f.";
%end;
** wakeup SAS system at 9:30 pm each evening
**;
data _null_;
a=wakeup(&wake);
%runn;
** delete existing SAS data sets on my local hard drive in
order to make
room for creation of the new SAS data sets created
by DMBS Copy **;
proc datasets lib=mhn ;
delete authorization_request;
delete pa_errors_history;
delete exportpalog ;
delete procedure_or_service ;
quit;
%runn;

options xsync;
X "cd C:\program files\Dbmscopy7";
X "dbmswin7 PLUS g:\acs\authorization_request.prg";
X "dbmswin7 PLUS g:\acs\export_pa_log.prg";
X "dbmswin7 PLUS g:\acs\pa_errors_history.prg";
X "dbmswin7 PLUS g:\acs\procedure_or_service.prg";
X "dbmswin7 PLUS g:\acs\user_id.prg";
/* run the report program */
%include st_rpt ;
%end;
%mend auto_rpt;
%auto_rpt;

-----Original Message-----
From: Mindy Diaz [mailto:***@YAHOO.COM]
Sent: Friday, October 10, 2003 10:30 AM
To: SAS-***@LISTSERV.UGA.EDU
Subject: Run a SAS program automatically


Hi,

I have a simple SAS program. I wish it can run automatically everyday at
12:00 A.M. My system is Windows.

Thanks.

Mindy
Ben Powell
2003-10-16 15:27:41 UTC
Permalink
Has someone mentioned you could use windows task manager? Set the default
behaviour of sas icons to run in batch mode then set a task for every day
to execute that icon. I use this every morning to update my survey datamart
with data from 4 or 5 access databases. You could use a free app such as
servers alive to email you if the machine goes down,

http://www.woodstone.nu/salive/

It was free last time I checked.

hth
Date: Thu, 16 Oct 2003 10:11:08 -0400
From: rpresley <***@GMCF.ORG>
Subject: Re: Run a SAS program automatically

Mindy,

Below is production code whih I use to run a SAS program every night. The
key is the use of the SAS function "WAKE". This function will cause the
SAS system to sit quietly until the specified time. In this particual
program I use a macro to cause the code to loop 30 times. With the windows
operating system I find it necessary to shut down and restart the computer
once a week or so. Therefore the loop of 30 is plenty for my purposes. If
you have quesitons feel free to contact me directly.

Rodney



/* Titlle: Copy MHN tables to SAS */
/* Programmer: R. Presley */
/* Initial: 5/17/03 */
/* modified: 6/13/03 call program status_soruce.sas
*/
/* Use the SAS wakeup function to execute a program at
specified date and time. This program executes system commands to
execute DBMS Copy programs which copy select Oracle tables to SAS */
/* ********************************** */
/* modified 6/18/03 by R.Presley to make a macro that will run each day
*/
** macro AUTO_RPT will run every day and then update the value of WAKE
by one day
**;
filename st_rpt 'g:\acs\status_source.sas';
libname mhn 'd:\temp\prod' ;
** set wakeup value each day at 9:00 pm
**;
%macro auto_rpt;
%do i=1 %to 30 ;
%if &i=1 %then %do;
data _null_;
** wake=dhms(today(),10,25,00);
wake=dhms(today(),21,30,00);
wake_f=put(wake,datetime16.);
call symput ('wake',wake);
call symput ('wake_f', wake_f);
%runn;
%put "The value of wake is &wake.";
%put "The formatted value of wake is &wake_f.";
%end;
%else %do;
data _null_;
wake=&wake + 60*60*24;
wake_f=put(wake,datetime16.);
call symput ('wake',wake);
call symput ('wake_f', wake_f);
%runn;
%put "The value of wake is &wake.";
%put "The formatted value of wake is
&wake_f.";
%end;
** wakeup SAS system at 9:30 pm each evening **;
data _null_;
a=wakeup(&wake);
%runn;
** delete existing SAS data sets on my local hard drive in
order to make
room for creation of the new SAS data sets created
by DMBS Copy **;
proc datasets lib=mhn ;
delete authorization_request;
delete pa_errors_history;
delete exportpalog ;
delete procedure_or_service ;
quit;
%runn;

options xsync;
X "cd C:\program files\Dbmscopy7";
X "dbmswin7 PLUS g:\acs\authorization_request.prg";
X "dbmswin7 PLUS g:\acs\export_pa_log.prg";
X "dbmswin7 PLUS g:\acs\pa_errors_history.prg";
X "dbmswin7 PLUS g:\acs\procedure_or_service.prg";
X "dbmswin7 PLUS g:\acs\user_id.prg";
/* run the report program */
%include st_rpt ;
%end;
%mend auto_rpt;
%auto_rpt;

-----Original Message-----
From: Mindy Diaz [mailto:***@YAHOO.COM]
Sent: Friday, October 10, 2003 10:30 AM
To: SAS-***@LISTSERV.UGA.EDU
Subject: Run a SAS program automatically


Hi,

I have a simple SAS program. I wish it can run automatically everyday at
12:00 A.M. My system is Windows.

Thanks.

Mindy

Continue reading on narkive:
Loading...