BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
panopolix
Calcite | Level 5

data_null_;

call symput ('datenow', put((date()-1), date9.));

run;

 

proc export data=mydata;

outfile="\\SharedFolder\REPORT_&'datenow'..xlsx"

dbms=xlsx replace;

run;

When I run this code, I am getting the date on the spreadsheet as REPORT_26MAR2020.xlsx

Would it be possible to get it in this format: REPORT_03.26.2020.xlsx

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
Reeza
Super User

Change the format in the CALL SYMPUT() to what you want it. Here you've specified date9, but I would recommend using yyyy.mm.dd which will sort correctly using ascending or descending.

 

call symputx('datenow', put(date()-1, yymmddp10.));

I also recommend changing to SYMPUTX which trims any extra spaces.

 

You also need to remove the single quotes in your outfile statement.

 

outfile="\\SharedFolder\REPORT_&datenow..xlsx"

 

panopolix
Calcite | Level 5

Thank you Reeza! That works.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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