I am trying to amend the macro below to accept a macro parameter as the \'location\' argument for a dir command. However I cannot get it to resolve correctly due to the nes
Make the following several changes and your code will work.
%macro get_filenames(location); %*--(1)--*;
filename pipedir pipe "dir ""%unquote(&location)"" /b" lrecl=32767; %*--(2)--*;
data filenames;
infile pipedir truncover;
input filename $char1000.;
put filename=;
run;
filename pipedir clear; %*--(3)--*;
%mend;
%get_filenames(d:\)
%get_filenames(d:\your dir) %*--(4)--*;
(1) End the %macro statement with a semi-colon;
(2) Surround the macro variable resolution with doubled-up double quotes and %unquote;
(3) Release the file handle by clearing it; and
(4) Don't single quote your input parameter. macro quote instead, if necessary.