Tips Talk:Adding a date and time stamp message to the SAS Log

From sasCommunity
Jump to: navigation, search

The timestamp info could be provided in a log without executing any step, with code like

    %put as at %now;

where %now is a macro defined as simply as

   %macro now( fmt=datetime21.2) /des='timestamp'; 
   %do;%sysfunc( datetime(), &fmt )%end;
   %mend  now ;

That macro could be extended to eliminate almost all macro debugging info like symbolgen - but that should be subject for another tip.

In recent releases (9.2+?), option FULLSTIMER adds a timestamp among end-of-step notes, too

--peterC (talk) 06:59, 5 February 2014 (CST)

Good Tip, but wouldn't it be more useful to suggest running the macro as part of, say, one's --Art T 19:04, 5 February 2014 (CST)

Agree with Art. And I am not sure why it even needs to be a macro (which then requires that the autoexec points to the macro lib. Just an open code %put statement like the following should suffice:

%put Job Started Execution at %sysfunc(time(),timeampm.) on %sysfunc(date(),worddate.).;
--Don Henderson (talk) 20:12, 5 March 2014 (CST)

I have reworked this tip and believe that it is ready, but since I essentially rewrote it, I probably ought not promote it.--Art Carpenter (talk) 01:12, 18 December 2014 (CST)

I like the new version and lets let one more reviewer (e.g., Art T or Peter) comment and then we can promote it. --Don Henderson (talk) 06:40, 18 December 2014 (CST)

I had already rated this as a good tip back in February, 2014 --Art T 10:27, 18 December 2014 (CST)

Since it was changed since you/Peter reviewed, I wanted an OK for the revision. Am assuming, based on your comment, that you still think this is a good tip. So I promoted it to Tip Ready.--Don Henderson (talk) 18:08, 10 January 2015 (CST)