Issue 29 - SAS UK - In The Know - Enewsletter
Saving Time and Money using SAS by Phil Holland
Phil’s new book offers an eclectic mix of practical techniques to make more use of SAS. Phil shares one of his top tips in this feature.
A most useful piece of code is this program to schedule a Window or UNIX SAS program to run at a specific time. Note this code should be run as part of a SAS macro, but running this code within Enterprise Guide requires the SAS Object Spawner to use the -ALLOWXCMD or -NONOXCMD command line option:
More info:
www.sas.com/apps/pubscat/bookdetails.jsp?pc=59507
1 %MACRO submit(command=, time=);
2 %IF %UPCASE(&sysscp.) EQ WIN %THEN %DO;
3 FILENAME cmd PIPE "at &time. &command.";
4 %END;
5 %ELSE %DO;
6 FILENAME cmd PIPE "at -f &command. &time.";
7 %END;
8 DATA _NULL_;
9 INFILE cmd;
10 INPUT;
11 PUT _INFILE_;
12 RUN;
13 %MEND submit;
14
15 %submit(command=script.cmd, time=14:50);
NOTE: The infile CMD is:
Unnamed Pipe Access Device,
PROCESS=at 14:50 script.cmd,RECFM=V,LRECL=256
Added a new job with job ID = 1
NOTE: 1 record was read from the infile CMD.
The minimum record length was 31.
The maximum record length was 31.
NOTE: DATA statement used (Total process time):
real time 8.17 seconds
cpu time 0.06 seconds
The code was taken from chapter 6, "Developing SAS Applications using Enterprise Guide", of my book, which is now available from SAS Publishing.
Click here to visit www.sas.com/uk