|
Thanks Bob,
"The docs" was referring to SAS 9.3 System Options Reference. The section
on logparm system option has Table 3.1 Directives for Controlling the Name
of SAS Log Files. But I just noticed looks like this may only work in
batch mode, and I'm working in interactive (building my first SAS/AF app).
So that could be the problem.
If I decide I really need this, will probably go the batch file route. And
I agree, a real timestamp needs the time as well as date.
Thanks,
--Q.
On Tue, 21 Feb 2012 15:48:46 +0000, DUELL, BOB <bd9439@ATT.COM> wrote:
>Hi Quentin,
>
>Your original note said you saw something about this "in the docs". To
what docs are you referring? The syntax you show looks like a date
formatting specification for UNIX. If Y, M, and D were supposed to be
Windows environment variables, I would have expected to see them surrounded
with percent signs rather than just prefixed (i.e. %Y%).
>
>For what it's worth, at the very least you can do this with a "batch" file
and generate your ALTLOG value as a Windows environment variable, something
like:
>
> set mylogfile=C:\junk\mylog_%date%.log
>
> (path to SAS) -altlog %mylogfile%
>
>As an aside, I would never make changes like this in a configuration file
unless I used a complete timestamp rather than just a date.
>
>Good luck,
>
>Bob
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Quentin McMullen
>Sent: Tuesday, February 21, 2012 7:12 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: altlog with timestamp
>
>Thanks Mark,
>
>Sorry for being dense, but... where would I put the %let statement to
>make the timing work out?
>
>That is, I thought (perhaps incorrectly) that I need to specify
>-altlog at invocation. So I've been trying it in my config file and
>on the invocation command. I don't think I can put a %let statement
>in my config file (can I?). I think putting %let in the autoexec
>would be too late (isn't it)?
>
>Just to add something beyond a question, here is my new favorite
>format for timestamps yyyymmddThhmmss:
>
>%put %sysfunc(datetime(),b8601dt);
>
>20120221T100848
>
>Thanks,
>--Quentin
>
>
>
>
>On Tue, Feb 21, 2012 at 9:59 AM, Terjeson, Mark <Mterjeson@russell.com>
wrote:
>> Hi Quentin,
>>
>> One alternative is to prespecify with SAS:
>>
>>
>> %let yyyymmdd=%sysfunc(putn(%sysfunc(date()),yymmddn8.));
>>
>> -altlog "C:\junk\mylog_&yyyymmdd..log"
>>
>>
>> for date and time:
>>
>> %let yyyymmdd=%sysfunc(putn(%sysfunc(date()),yymmddn8.));
>> %let tmptime=%sysfunc(compress(%sysfunc(putn(%sysfunc(time
()),time8.)),:));
>> %let hhmmss=%sysfunc(putn(&tmptime,z6.));
>> %let yyyymmddhhmmss=&yyyymmdd&hhmmss;
>>
>> -altlog "C:\junk\mylog_& yyyymmddhhmmss..log"
>>
>>
>>
>> As you have done, in descending unit of measure order so
>> that filenames will sort in directory listings as desired.
>>
>>
>>
>> Hope this is helpful.
>>
>>
>> Mark Terjeson
>> Investment Business Intelligence
>> Investment Management & Research
>> Russell Investments
>> 206-505-2367
>>
>>
>> Russell
>> Global Leaders in Multi-Manager Investing
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Quentin McMullen
>> Sent: Monday, February 20, 2012 8:47 PM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: altlog with timestamp
>>
>> Hi All,
>>
>> I'm trying to set up an automatically timestamped -altlog. Win XP.
>>
>> From the docs, it looks like it should be as easy as specifying:
>> -altlog "C:\junk\mylog_%Y%M%D.log"
>>
>> during invocation. But I've tried putting that in the defintion for
>> the SAS icon, and in my config file, and can't get the date directives
>> to resolve. Can someone enlighten me?
>>
>> Kind Regards,
>> --Quentin
|