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

Attachment
Esteemed Advisor
Posts: 6,647

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
Grand Advisor
Posts: 9,576

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

Esteemed Advisor
Posts: 6,647

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
Ask a Question
Discussion stats
  • 4 replies
  • 168 views
  • 0 likes
  • 3 in conversation