Quoting the directory path in below statement, when its supplied as a macro variable,
path in
%let logdir = c:\test;
%let filot = %str(%'dir %")&logdir%%str(%" /a-d /b /s%');
%put &filot;
filename catd pipe &filot ;
filename catd pipe %nrstr(&filot);
'%put' resolves &filot to the exact value in filename statement, but none other statements gets resolved.
D Moovendhan
%let logdir = c:\test;
%let command = dir "&logdir" /a-d /b /s ;
%put &command;
filename catd pipe %sysfunc(quote(&command));
try this:
filename catd pipe "&filot" ;
Thank you Bailey, I have tried this, but it doesn't work...
%let logdir = c:\test;
%let command = dir "&logdir" /a-d /b /s ;
%put &command;
filename catd pipe %sysfunc(quote(&command));
Thank you Tom this was more helpful.. Now I know new function quote..
You can also just double the internal quotes yourself.
filename catd pipe "dir ""&logdir"" /a-d /b /s ";
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.