BookmarkSubscribeRSS Feed
🔒 This topic is locked. We are no longer accepting replies to this topic. Need further help? Please sign in and ask a new question.
SAS_Tipster
Moderator

SAS listing output contains date and time stamps at the top of each output page. However, the associated SAS logs do not. You can however add a date time stamp to the LOG using a couple of different methods.

 

* DATA Step;
data _null_;  
    datetime = datetime();
    put datetime= datetime18.;
run;

Or you can use the macro language.

 

%put Job Started Execution at %sysfunc(time(),timeampm.) on %sysfunc(date(),worddate.).;

Originally posted by Lpweaver on sasCommunity.org.

1 REPLY 1
Tom
Super User Tom
Super User

The SAS log does have the date and time at the top.

1                                                          The SAS System                                 09:42 Monday, May 14, 2018

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA. 
NOTE: SAS (r) Proprietary Software 9.4 (TS1M5) 
      Licensed to XXX, Site ###.
NOTE: This session is executing on the ZZZ platform.

But perhaps this is intended for SAS/Studio or other processing where the the full log is not normally provided?

 

Also note that the DATETIME18. format is broken.  It should have room for 4 digit years, but it only displays the last 2 digits of the year.  So either use DATETIME19. to get 4 digit years or use DATETIME16. if you only need 2 digit years.  

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Visit a random SAS tip This SAS Tips board is not open for replies or comments, but we welcome your feedback and questions. Have a question or comment about this tip? Start a new topic in one of our discussion boards, and reference this tip topic.
Discussion stats
  • 1 reply
  • 12145 views
  • 0 likes
  • 2 in conversation