- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have a macro text value I have initiated with the %let statement. The value is entered manually and then used throughout the code, including in a ODS output statement where I have the macro value in the file name of the PDF. However, each time I run this it does not read the macro value and outputs the macro name instead. I know to use double quotes for these. One of the folder names in the directory has a & (unable to change that on my end). Each time I export there I get warnings in my log about it not locating a macro, but I usually overlook it because I know it's a folder name. It doesn't impact SAS's ability to find the location and export the file, however this is my first attempt in using a macro in the filename when exporting there. Could that be affecting SAS's ability to read an actual macro in the filename statement?
Have been unable to test other export locations as this is the only one I can map to at the moment.
%let IDvlue = XX999;
ods pdf file="\\....\OUTPUT_Table_&IDvlue.pdf";
...
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I believe you need an extra . period after the macro var reference i.e.
%let IDvlue = XX999;
ods pdf file="\\....\OUTPUT_Table_&IDvlue..pdf";
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I believe you need an extra . period after the macro var reference i.e.
%let IDvlue = XX999;
ods pdf file="\\....\OUTPUT_Table_&IDvlue..pdf";
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you look in that folder you likely have a file without an extension the looks like Output_table_XX999pdf.
The dot character after a macro variable indicates the end of the macro variable name, almost like a concatenation.
If macrovar has the value of ABC then ¯ovar.XYZ resolves to ABCXYZ. Without the dot you would get an error for ¯ovarXYZ that the macro variable MacrovarXYZ does not exist. So when you have a macro variable that has to be followed by a dot, such as in a file extension or a libname.data set name you need an extra dot. One to end the macro variable the next to be literal text.