| Date: | Thu, 31 Jul 2008 13:22:23 -0400 |
| Reply-To: | "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV> |
| Subject: | Re: Formating a Macro value ?? |
| In-Reply-To: | <c2192a610807310829mf256397v5b60b5d4363aac0f@mail.gmail.com> |
| Content-Type: | text/plain; charset=us-ascii |
> From: SAS_learner
>
> Data test ;
> time = %sysfunc(datetime());
> Format time datetime20.;
> call symput('time', time );
> Run;
> proc printto log="&logdir.mntx3301_lis_log_&time..txt" new ;
> run;
> Proc Print ;
> Run;
>
> The Purpose is get a log file with the date and time so that
> I know what is
> log that has been run when ?? but some how using above code
> dose result in
> formatted value of macro time. What is that I am missing ??
you already have a suggestion using %sysfunction datetime20.
which will not work
since DOS will not accept a filename with a colon in it.
if you want to use the system date and time
which is accurate to minutes.
> proc printto
log="&logdir.mntx3301_lis_log_&SysDate-%sysfunc(translate(&SysTime.,-,:)
).txt" new ;
AUTOMATIC SYSDATE 31JUL08
AUTOMATIC SYSDATE9 31JUL2008
AUTOMATIC SYSTIME 13:16
you can use the job start time which is in the first hex16. chars of
SysProcessId
AUTOMATIC SYSPROCESSID 41D6D86CAD0126E94020000000000000
> proc printto
log="&logdir.mntx3301_lis_log_%substr(&SysProcessId.,1,16)).txt" new ;
Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
|