I'm using the following code write the filenames from a directory into a dataset. Currently it reads in all the filenames in that directory. I'm having trouble trying to figure out how to read in only specific filenames. For example, how can I return only files like 'abc%.txt'?
Code:
%macro get_filenames(location);
filename _dir_ "%bquote(&location.)";
data filenames(keep=fname);
handle=dopen( '_dir_' );
if handle > 0 then do;
count=dnum(handle);
do i=1 to count;
fname=dread(handle,i);
output filenames;
end;
end;
rc=dclose(handle);
run;
filename _dir_ clear;
%mend;
%get_filenames("c:\temp\");