BookmarkSubscribeRSS Feed
cuevasj
Quartz | Level 8

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?

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

1. What's that quote in   %let today='12/11/2019; 

 

2. Like this?

contentdisp="attachment; filename=""&VA_school_year. MS Promo &today..xml"" ";

Cameron
Fluorite | Level 6

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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 902 views
  • 0 likes
  • 3 in conversation