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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.