BookmarkSubscribeRSS Feed
kdzieciolowski
Calcite | Level 5

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

3 REPLIES 3
Tom
Super User Tom
Super User

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.

kdzieciolowski
Calcite | Level 5
?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.

Patrick
Opal | Level 21

@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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 694 views
  • 0 likes
  • 3 in conversation