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

I am using this code to populate the date in filename as seen below but the output is not returning the date. Filename comes out like this SAS_backup_roll_&now1..xlsx  - This works fine in BASE SAS but not in VIYA Studio, using PROC Export as well to export multiple worksheets to the excel workbook. Any help will be greatly appreciated. 

 

%let now1=%sysfunc(today(),yymmddd10.);
filename backup filesrvc folderpath= '/USCG/Aviation Logistics Division/RMB/OUTPUTS/' filename='SAS_backup_roll_&now1..xlsx'; 

Proc export data=work.tpcA
outfile=backup
dbms=xlsx replace;
sheet='A-TPC funds';
run;

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

I'm not sure how it could ever work in any version of SAS with single quotes after filename=

 

It should work with double-quotes

 

... filename="SAS_backup_roll_&now1..xlsx"; 

 

unless there are other problems that are not obvious.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

I'm not sure how it could ever work in any version of SAS with single quotes after filename=

 

It should work with double-quotes

 

... filename="SAS_backup_roll_&now1..xlsx"; 

 

unless there are other problems that are not obvious.

--
Paige Miller
bweeks59
Obsidian | Level 7

Thanks so much for catching the single quote, this worked perfectly after I made the change. I am reusing code someone else wrote and did not see this...not sure how it worked in BASE but that is she was using it before we upgraded to VIYA. Now I am curious if it really ran there but not looking back. I really appreciate the help, got into the weeds and could not see it. 

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 save with the early bird rate—just $795!

Register now

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