BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rpinder
Fluorite | Level 6

Is there a way to get the timestamp in the Header of .RTF output files to report the actual time the job was submitted?  It appears the date which is inserted is the time the SAS session began (?)

 

Code:

 

title "-- title here --";
ods noptitle;
ods rtf startpage=now;

 

which, on May 5, produces:

05:06 Saturday, May 4, 2019  3

 

Thanks,

Rich

[ long (LONG) time SAS user, first time poster Smiley Wink ]

1 ACCEPTED SOLUTION

Accepted Solutions
rpinder
Fluorite | Level 6

 ....normal behavior is to display the date/time that the SAS session started.

 

Thanks for confirming.  

Interesting - IF I specify the output rtf (see below), it always gives same behaviour I've reported (session start time).  IF I leave the output file OPEN in an editor, run same code again, SAS spawns a second .rtf (sasrtf.rtf - likely a default?), which  EACH time the job runs, gets the CURRENT TIME inserted !   Wild.

 

Thanks all, I'll work with what I've learned.  

 

ods rtf file  = "C:\temp\test.rtf" sasdate style = dove
bodytitle startpage = no;

title "Title - top of each output set";
ods noptitle;
ods rtf startpage=now;

data temp;
set sashelp.bei;
keep trees;
run;


proc freq data = temp;
title2 "more details added to title1";
run;

ods rtf close;
run; 

  

View solution in original post

8 REPLIES 8
ghosh
Barite | Level 11

Just put 

title "Time/Date: %sysfunc(time(),time.) %sysfunc(date(),worddate.)";

 

rpinder
Fluorite | Level 6

Thanks for this workaround - but the 'title' is used/changed on each component I send to the ODS system (mainly output from proc freq's and contents).  I inserted those three lines to show the simple syntax I'm using in the program.  I dont want timestamps inside titles.

 

Rather, I believe there is somewhere a built in behavior of ODS which default labels each page with a timestamp.  I want to know if this a bug, or intended feature:- the timestamp is the time SAS session is started, rather the time the job is executed.  (and, I'm lookin for the latter behavior )

 

thanks

rich

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

use the datetime() returns SAS datetime value at moment of execution in NNNNNNNNNN.N

here is the link.

https://v8doc.sas.com/sashtml/lrcon/zenid-63.htm

 

 

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

@long time programmer hmm

ghosh
Barite | Level 11

Could suggest a couple of options. 

 

Use Title for the date stamp and subsequently use Title2, etc.

 

My preferred approach to to set up the report as an ods layout (for pdf and rtf reports) and explicitly define the ods regions for header and footer.

  

Tom
Super User Tom
Super User

If you have the DATE option set then the normal behavior is to display the date/time that the SAS session started.  If you set the option to NODATE instead then no date/time is added to the first title line.

 

Are you seeing something different in RTF output than you would see in normal listing (text only) output or other ODS destinations?

Or are you asking to use a different date/time for the title?

If so what date/time would you like to use?

 

rpinder
Fluorite | Level 6

 ....normal behavior is to display the date/time that the SAS session started.

 

Thanks for confirming.  

Interesting - IF I specify the output rtf (see below), it always gives same behaviour I've reported (session start time).  IF I leave the output file OPEN in an editor, run same code again, SAS spawns a second .rtf (sasrtf.rtf - likely a default?), which  EACH time the job runs, gets the CURRENT TIME inserted !   Wild.

 

Thanks all, I'll work with what I've learned.  

 

ods rtf file  = "C:\temp\test.rtf" sasdate style = dove
bodytitle startpage = no;

title "Title - top of each output set";
ods noptitle;
ods rtf startpage=now;

data temp;
set sashelp.bei;
keep trees;
run;


proc freq data = temp;
title2 "more details added to title1";
run;

ods rtf close;
run; 

  

ghosh
Barite | Level 11
Try the suggestion I provided. It will embed the execution time and date

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 2317 views
  • 1 like
  • 4 in conversation