|
Copy and paste the code below in to your program editor and see if it
gives you what you want. In my example I am using the value of the
DATETIME() function to find the SAS datetime value immediately before
running my reports.
I think that is better than using the value of the &systime macro
symbol table variable, as %systime is assigned once when you start
your SAS session and does not change during it.
My approach takes in to account any periods of time that elapse
between when you start your session and you generate your report. You
can cut/paste the DATA _NULL_ step and put it before each report you
need to create as a PDF, so you have the current date/time value in
the PDF file name.
Also, I have given you two options. The "squished" value shows the
hours minutes and seconds "squished together" while the "spaces" value
shows them with an underscore symbol separating them. In my opinion,
the "spaces" value is easier to read.
Hope this helps.
* make up some data;
data madeup;
do i = 1 to 10;
x = uniform(999) * 10000;
y = uniform(777) * 12345;
output;
end;
run;
* create macro variables with the current SAS datetime value
before running PROC PRINT and sending output to the PDF
destination;
data _null_;
* open sashelp.vmacro to see these values in the macro symbol table
after you have run this step;
call symputx('squished',compress(put(datetime(),datetime24.),':'));
call
symputx('spaces',tranwrd( put(datetime(),datetime24.) ,':','_')); ;
run;
* print report with hours, minutes and seconds squished together in
the PDF file name;
options symbolgen;
ods listing close;
ods pdf file="C:\file_&squished..pdf" style=minimal;
proc print data=madeup;
title 'madeup data';
run;
ods pdf close;
ods listing;
* print report with hours, minute and seconds separated by spaces in
the PDF file name;
options symbolgen;
ods listing close;
ods pdf file="C:\file_&spaces..pdf" style=minimal;
proc print data=madeup;
title 'madeup data';
run;
ods pdf close;
ods listing;
Andrew Karp
Sierra Information Services
http://www.SierraInformation.com
On Nov 3, 10:01�pm, Aj <ajeetsubraman...@gmail.com> wrote:
> Hi All
>
> I am trying to output files with the ODS option with system time stamp
> on it :
>
> ODS PDF FILE = "C:\test\RUN_&sysdate._&system..pdf";
> PROC CONTENTS DATA = �PERSON;
> RUN;
> ODS PDF CLOSE;
>
> The results in a fle with a colon in between the date and time
> RUN_03NOV08_20:59.pdf
>
> Can the extension be generated as RUN_03NOV08_2059.pdf WITHOUT the
> colon in between.
>
> Have a great day ahead
>
> Aj
|