Desktop productivity for business analysts and programmers

Dynamic output name

Reply
Contributor
Posts: 37

Dynamic output name

Hi Gurus,

 

I would like to ask if anyone know how to dynamically assign the output file name with current system datetime ?

 

I have attached the sample.

 

 

Thank you for your help


CurrentDateTime.PNG
Super User
Posts: 10,592

Re: Dynamic output name

You might try to use one of the automatic macro variables that contain time information. Although I'm not sure if it breaks EG's dataset tracking (making creating process flows harder).

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 10,850

Re: Dynamic output name

data x_%sysfunc(translate(%sysfunc(datetime(),datetime20.),_,:));
input col1 $ col2 $ col3 $;
x=catx(',',of col1-col3);
cards;
s y x
;
run;
Contributor
Posts: 37

Re: Dynamic output name

Hi KSharp,

 

Thank you for your help, do you know how to do that in proc sql?

 

thanks

Super User
Posts: 10,592

Re: Dynamic output name


SASNE wrote:

Hi KSharp,

 

Thank you for your help, do you know how to do that in proc sql?

 

thanks


proc sql;
create table x_%sysfunc(translate(%sysfunc(datetime(),datetime20.),_,:)) as
select ....
from ....
;
quit;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 4 replies
  • 243 views
  • 0 likes
  • 3 in conversation