- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 ]
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
....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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Just put
title "Time/Date: %sysfunc(time(),time.) %sysfunc(date(),worddate.)";
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@long time programmer hmm
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
....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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content