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-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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
  • 11401 views
  • 0 likes
  • 2 in conversation