Architecting, installing and maintaining your SAS environment

Windows Batch: How to Print a Timestamp in Log file

Reply
Contributor
Posts: 31

Windows Batch: How to Print a Timestamp in Log file

Hi,

I have created a Windows Batch file to execute the sas code, I want to append the DateTimestamp to the Log file name. Like "NameSmiley Very Happyatetime.Log"

I have created below command in batch file.

"C:\Program Files\SAS\SASFoundation\9.2\sas.exe" -autoexec 'C:\Program Files\autoexec2.sas' -sysin "C:\Program Files\Usage per Channel.sas" -log "C:\Program Filesfile://\\GL1015018\SAS\Usage per Channel.

log"

When I tried to do it using Proc Print to in .SAS code and removed -log command in batch file, batch did not run properly.

Any help would be appreciated.

Thanks,

Nikhil

Super User
Posts: 11,343

Re: Windows Batch: How to Print a Timestamp in Log file

Posted in reply to nikhil_khanolkar

Did you mean PROC PRINTTO? If not that may be an option if included in the program.

Frequent Contributor
Posts: 106

Re: Windows Batch: How to Print a Timestamp in Log file

Posted in reply to nikhil_khanolkar

Hi Nikhil,

I ran into this a while ago - might help you, particularly as you're already writing batch files.

http://www.phusewiki.org/docs/2008/PAPERS/CC03.pdf

Hope this helps

Nik

Respected Advisor
Posts: 4,173

Re: Windows Batch: How to Print a Timestamp in Log file

Posted in reply to nikhil_khanolkar

Have a look into the directives for log names in the second half of below link.

SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

Frequent Contributor
Posts: 106

Re: Windows Batch: How to Print a Timestamp in Log file

This is the far better option. I think you need -logparm "rollover=session" in there for it to work

Ask a Question
Discussion stats
  • 4 replies
  • 886 views
  • 0 likes
  • 4 in conversation