- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I can not get this to work. It will not resolve the macro - why ?
%let dato=%sysfunc(putn(%eval(%sysfunc(today())-2),yymmddn8.));
%put &dato;
filename tmp pipe 'dir "C:\SAS\Data\data _&dato._*.zip" /b';
Hope you can help
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Macro variables will not resolve inside single quotes.
Here's a workaround, you can use the macro variable &str where your FILENAME statement was.
%let str=filename tmp pipe %str(%')dir "C:\SAS\Data\data _&dato._*.zip" /b%str(%');
%put &=str;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Macro variables will not resolve inside single quotes.
Here's a workaround, you can use the macro variable &str where your FILENAME statement was.
%let str=filename tmp pipe %str(%')dir "C:\SAS\Data\data _&dato._*.zip" /b%str(%');
%put &=str;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Macro variables inside single quotes do not resolve
You may want to look at this code:
%let dato=%sysfunc(putn(%eval(%sysfunc(today())-2),yymmddn8.)); %put &dato; %put in filename: 'dir "C:\SAS\Data\data _&dato._*.zip" /b'; %put in filename double quote: "dir ""C:\SAS\Data\data _&dato._*.zip"" /b";
to see that the macro variable is not resolving.
The second version uses all double quotes and doubles the quotes around the path so that the single double quote doesn't get considered as the matching quote for the first one.