LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2003, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 16 Oct 2003 10:11:08 -0400
Reply-To:     rpresley <rpresley@GMCF.ORG>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         rpresley <rpresley@GMCF.ORG>
Subject:      Re: Run a SAS program automatically
Comments: To: Mindy Diaz <xinzhang90@YAHOO.COM>
Content-Type: text/plain; charset="iso-8859-1"

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:xinzhang90@YAHOO.COM] Sent: Friday, October 10, 2003 10:30 AM To: SAS-L@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


Back to: Top of message | Previous page | Main SAS-L page