Date: Thu, 30 Jul 2009 09:41:10 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: Macro Function for putting the current time into file name.
In-Reply-To: A<343534.9702.qm@web50904.mail.re2.yahoo.com>
Content-Type: text/plain; charset="us-ascii"
Hi Brian,
A couple of subtleties in the macro world assignments.
- just like you used TODAY() directly in the %SYSFUNC
you can use the TIME() directly as well.
- if you did want to use PUT() you need to know that
in the macro enviroment it doesn't know about PUT(),
in the macro enviroment you use PUTN() or PUTC().
- ALL arguments in the macro environment are character
string text, so no quoting used, you see the colon
without quotes now.
(by the way, "character string text", isn't that
redundant-redundant? That's kinda like me saying
that my name is "Mark Mark Mark")
- I threw one more %sysfunc in just to get the leading
zero for the hours portion of the integer.
%LET RUNDATE = %SYSFUNC(TODAY(),YYMMDDN8.);
%LET RUNTIME =
%sysfunc(putn(%sysfunc(compress(%sysfunc(TIME(),TIME.),:)),z6.));
%put RUNDATE is >&RUNDATE<;
%put RUNTIME is >&RUNTIME<;
Hope this is helpful.
Mark Terjeson
Investment Business Intelligence
Investment Management & Research
Russell Investments
253-439-2367
Russell
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Brian Wallace
Sent: Thursday, July 30, 2009 9:26 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Macro Function for putting the current time into file name.
I don't know what I'm doing wrong:
%LET RUNDATE = %SYSFUNC(TODAY(),YYMMDDN8.);
%LET RUNTIME = %SYSFUNC((COMPRESS(PUT(TIME(),TIME.),':')),$6.);
DATA APPLE;
INPUT SITE $ 1-3 SUBJECT $ 5-7 CODE 9-12 CYCLE $ 14 MEAS1 16-19 MEAS2
21-24 MEAS3 26-29;
DATALINES;
101 102 1234 1 3.14 5.32 9.18
102 103 2345 2 5.12 6.06 7.89
102 204 3456 1 4.15 9.65 4.09
;
OPTIONS ORIENTATION=LANDSCAPE;
ODS PDF file="C:\atemp\FOX\APPLE&RUNTIME..pdf";
PROC PRINT DATA = APPLE;
RUN;
ODS PDF CLOSE;
QUIT;
The RUNDATE Macro runs fine. RUNTIME doesn't resolve correctly. Is
there
a time format that would turn 12:30:15 into 123015? HHMMSSN. and
HHMMSS. doesn't seem to work.
Thank you for any help,
Brian Wallace