In the VIYA environment, JobExectution to be exact,
how do you add a macro variable to a filename statement?
This is what I have:
%let VA_school_year=2019-20;
%let today='12/11/2019;
filename xmlfile filesrvc parenturi="&SYS_JES_JOB_URI"
name='_webout.xml'
contenttype='application/vnd.ms-excel'
contentdisp='attachment; filename=&VA_school_year. MS Promo &today..xml';
ods tagsets.excelXP file=xmlfile options(sheet_name="Overall Schoolwide Progress" frozen_headers='1');
I have tried with double quotes like this: ...fielname="&VA_school_year." MS Promo "&today.".xml'; ...
I have tried with no quotes, single quotes, with period and without period. When the file is produced the macro value is not substituted for the macro variable.
Any suggestions?
1. What's that quote in %let today='12/11/2019; ?
2. Like this?
contentdisp="attachment; filename=""&VA_school_year. MS Promo &today..xml"" ";
Macro variables inside strings surrounded by single quotes are not resolved by the macro processor. So you need to hide the single quotes until the macro variables are resolved. to do this replace each single quote with a macro quoted single quote: %STR(%')
For more information read the section about macro quoting in the Macro Language: Reference manual.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
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.