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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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