DATA Step, Macro, Functions and more

How do I record in the SASLOG the date and time of each program run

Reply
New Contributor
Posts: 2

How do I record in the SASLOG the date and time of each program run

[ Edited ]

I'd like to record in SASLOG the date and time of running programs. I have a manual solution:

 

 

%put START TIME: %sysfunc(datetime(),datetime14.);
data temp;
x=1;
run;
proc print data=temp ;
run;

 

with the saslog:

 

81 %put START TIME: %sysfunc(datetime(),datetime14.);
START TIME: 29OCT17:13:14
82 data temp;
83 x=1;
84 run;

 

 

but I don't want to manually add %PUT every time I run a code. Instead, I would like to make a change in SASLOG configuration to get datetime stamp automatically with each run of any code opened in the SAS session.

 

I looked up OPTIONS DATE (attached) does not produce the date in the output nor saslog.

Many thanks for any hints!

 

Krzysztof

Super User
Super User
Posts: 7,076

Re: How do I record in the SASLOG the date and time of each program run

Posted in reply to kdzieciolowski

SAS already writes the starting time at the top of the log. 

You could just add up the times for the previous steps if you really needed to figure out when a particular one started.

Otherwise use your method to add you own notes to the log.

New Contributor
Posts: 2

Re: How do I record in the SASLOG the date and time of each program run

?Thanks Tom. However, my SASLOG does not show date nor time anywhere despite the OPTIONS DATE being checked in the SAS System Options. No date when starting a new SAS session nor when running the code.

Respected Advisor
Posts: 4,173

Re: How do I record in the SASLOG the date and time of each program run

Posted in reply to kdzieciolowski

@kdzieciolowski

Line 1 in the SAS log should show the start time BUT it's always the time when SAS got invoked. So that works nicely for batch jobs but doesn't give you a lot of useful information for other modes of running SAS.

 

You method looks good to me.

Ask a Question
Discussion stats
  • 3 replies
  • 73 views
  • 0 likes
  • 3 in conversation