DATA Step, Macro, Functions and more

How to export excel file ending with the date of export

Accepted Solution Solved
Reply
Super Contributor
Posts: 412
Accepted Solution

How to export excel file ending with the date of export

Hi Everyone,

 

I want to export my data to excel and the name of the excel file end with _mmddyy_hourminute of the date I export.

 

Could any help me please?

 

Thanks,

 

HC

 

 


Accepted Solutions
Solution
‎06-01-2017 08:22 PM
Super User
Posts: 19,805

Re: How to export excel file ending with the date of export

You need to figure out the exact format that will work for you but the idea is as follows:

 

proc export ....  outfile = " path to file _ %sysfunc(today(), yymmdd8.)_%sysfunc(time(), time8.).xlsx"

The follow helps for testing your formats. I would highly recommend a YYMMDD format for the date then it will at least sort correctly by default which it won't otherwise. 

%let date = %sysfunc(today(), yymmdd8.);
%let now = %sysfunc(time(), time8.);

%put &date _ &now;

View solution in original post


All Replies
Solution
‎06-01-2017 08:22 PM
Super User
Posts: 19,805

Re: How to export excel file ending with the date of export

You need to figure out the exact format that will work for you but the idea is as follows:

 

proc export ....  outfile = " path to file _ %sysfunc(today(), yymmdd8.)_%sysfunc(time(), time8.).xlsx"

The follow helps for testing your formats. I would highly recommend a YYMMDD format for the date then it will at least sort correctly by default which it won't otherwise. 

%let date = %sysfunc(today(), yymmdd8.);
%let now = %sysfunc(time(), time8.);

%put &date _ &now;
Super Contributor
Posts: 412

Re: How to export excel file ending with the date of export

Thanks a lot, Reeza.
HC
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 106 views
  • 0 likes
  • 2 in conversation