Hello
I currently set the value of a file name as %let export_db="E:\data\2020 21\Q2\inst5555.xlsx";
I can set the institution variable as %let export_db="E:\data\2020 21\Q2\inst_&dqInst..xlsx" (where dqinst is set separately) and it works. But I have many different institutions at various periods in their data and I would like to create variables for fiscal year and quarter so I don't have to change all the time but how do I put it together? For example, below doesn't work:
"E:\data\"||&fiscal||"\"||&qtr||"\"||"DAD DQ_&DQInst..xlsx"
Any and all help greatly appreciated.
You don't need || to concatenate macro variables and text. Try this:
"E:\data\&fiscal\&qtr\DAD DQ_&DQInst..xlsx"
Thank you for your responses. Previously, when I wasn't "building from variables", the Excel file would just open up with the name I had created i.e. DAD_DQ_Inst5555.xlsx. But now that I am building the file name from variables I get an error message that "physical file does not exist". Why would that be and how do I correct it? Thanks.
You are correct, Reeza, I was missing a subfolder in the name. Now it works and all is well. Thanks very much.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.