Date: Wed, 1 Dec 2004 23:44:55 +1100
Reply-To: Scott <usenet739_yahoo_com_au@CRONKITE.CC.UGA.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Scott <usenet739_yahoo_com_au@CRONKITE.CC.UGA.EDU>
Subject: Re: What do you change to have a unique/numbered LOG/LST name?
On my system this returns 01-Dec-04 because of my regional settings. In
addition to PERL, cscript might be another (better?) solution that would
return the date independent of the regional settings.
"Jack Hamilton" <JackHamilton@FIRSTHEALTH.COM> wrote in message
> It's pretty easy to capture the date in Windows NT (and above):
> @echo off
> FOR /f "tokens=2-4 delims=/ " %%a in ('DATE/T') do SET
> echo DATE is %DATE%
> DATE is 2004-11-03
> Just leave the dashes out of the FOR statement if you don't want them.
> Time is more difficult. The TIME /T command prints only the hour and
> minute, without seconds, and uses regional display settings, so you
> can't be sure what you'll get back.
> If you need the time, you could use the Windows Scripting Host (Visual
> Basic or JScript) rather than a batch file. It comes with recent
> versions of Windows.
> Manager, Technical Development
> Metrics Department, First Health
> West Sacramento, California USA
>>>> Scott <usenet739_yahoo_com_au@CRONKITE.CC.UGA.EDU> 10/31/2004 6:09
> PM >>>
> Look, I love SAS...really! I just think invoking SAS to create a batch
> to invoke SAS in batch, then scheduling both jobs, is not the best
> for this problem. I would argue that, if the native Windows command
> interpreter made it easy to capture and format the output of datetime,
> no here would suggest the below approach; they would say to just
> pre-determine the log and lst file names, then invoke SAS
> appropriately. I
> do agree that installing PERL and, to a lesser extent, learning PERL
> much to learn in this scenario), could be an issue.
> Here is a PERL script to do what Zac wants:
> # Create a string as yymmdd.hhmmss, with zero leading padding
> @datetime = localtime;
> $dt = join '',
> sprintf("%02d",$datetime); # this is yymmdd.hhmmss
> # Where do you want to write the output files?
> # Write them to the same path as where this PERL script is located
> use Cwd;
> $path = cwd();
> # Invoke SAS
> $cmd = "sas -nologo -icon -sysin \"$path/myprogram.sas\" -log
> \"$path/myprogram.$dt.log\" -print \"$path/myprogram.$dt.lst\"";
> print $cmd; # for debugging
> system $cmd; # comment out during debugging, uncomment to execute
> "Jones Martyn" <Martyn.Jones@UK.FUJITSU.COM> wrote in message
>> Why learn PERL when you've already got SAS? Execute SAS to build the
>> file to do what you want....
>> Schedule a .bat file containing....
>> "c:\Program Files\SAS Institute\SAS\V8\sas.exe" -autoexec
>> D:\Data\SASFiles\V8\batchautoexec.sas -sysin
>> Where setbatchdailylog.sas is ....
>> data _null_;
>> file 'd:/data/sasfiles/v8/batchdaily.bat';
>> format date date9. datec $9.;
>> saslit='"c:\Program Files\SAS Institute\SAS\V8\sas.exe"';
>> autolit=' -autoexec D:\Data\SASFiles\V8\batchautoexec.sas';
>> sysinlit='-sysin D:\Data\SASFiles\V8\batchdaily.sas';
>> loglit='-log ' || 'D:\Data\SASFiles\V8\batchdaily'
>> put saslit autolit sysinlit loglit;
>> And subsequently schedule 'd:/data/sasfiles/v8/batchdaily.bat'....
>> -----Original Message-----
>> From: Scott [mailto:usenet739_yahoo_com_au@CRONKITE.CC.UGA.EDU]
>> Sent: 28 October 2004 12:36
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: Re: What do you change to have a unique/numbered LOG/LST
>> If it were me, I'd give up on Windows' brain dead command
>> install ActiveState PERL (free), pre-calculate the timestamp in the
>> script, and invoke SAS with the -log and -print options. If this
> would be
>> an option for you, let me know and I can send you a sample PERL
>> does exactly what you want.
>> You can get PERL from http://www.activestate.com/Products/ActivePerl/
>> "Zack Haynes" <Zack.Haynes@BRISTOLWEST.COM> wrote in message
>>> Dear SAS-L;
>>> What setup changes are needed to allow Win SAS
>>> to create a unique .LOG and .LST file name for
>>> the invoked SAS program. For example, a batch
>>> file contains this command:
>>> c:\sas\sas.exe c:\vssdev\saspgm1.sas
>>> When above is executed SAS may create the following:
>>> SASPGM1.LOG SASPGM1.LST
>>> What I'd like to have:
>>> SASPGM1.041020.132534.LOG SASPGM1.041020.132534.LST
>>> Is this possible? We are using Win SAS 8.2. Thanks.
>>> Zac Haynes, Systems & Applications Programmer, 714-404-8840.
>>> ISPF Dialog, REXX, Scripts, SAS, Endevor, DB2, SQL, & Macro.
>>> NOTE: THIS IS A CONFIDENTIAL COMMUNICATION. This transmission is
>>> only for the use of the individuals or entity to which it is
>>> you are not the intended recipient, or the person responsible for
>>> the message to the intended recipient, please return or delete it
>>> immediately. Although this e-mail and any attachments are believed
> to be
>>> free of any virus or other defect, it is the responsibility of the
>>> to ensure that it is virus free and no responsibility is accepted by
>>> any loss or damage arising in any way from its unauthorized