Reputation: 85
How can I add the system date in the body and by doing this, will it generate a new file without replacing the old one? Thanks in advance.
ods listing CLOSE;
ods HTML path="drive:\folder" body='title-(systemdate).html' style =
styles.test;
OPTION LS=195 PS=500 ;
TITLE; FOOTNOTE;
Upvotes: 1
Views: 586
Reputation: 12465
You can use the automatic macro variable &sysdate9
.
body="title-(&sysdate9.).html"
Make sure you use double quotes.
If you don't want that format, then you can use that variable and a putn
call to reformat it.
%let new_dt = %sysfunc(putn("&sysdate9."d,mmddyyd10.));
...
body="title-(&new_dt.).html"
Note: &sysdate9
is set when the session starts. It is not the date as of being called, it is as of SAS starting up.
If you want the current date, use date()
function.
%let new_dt = %sysfunc(putn(%sysfunc(date()),mmddyyd10.));
...
body="title-(&new_dt.).html"
Upvotes: 3