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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 857 views
  • 0 likes
  • 2 in conversation