Hello, Thank you! It is almost working. Now since the actual file path is very long the variable, truncates. I only need the actual filename. How can I fix this? I think it is something that says only take the last 9 characters in the filename (_MMDDYYYY). But I am not sure where to put this in the code. Here is what I have so far. %macro impt(filename,i,fname);
proc import DATAFILE="&filename" OUT=_&i DBMS=xls REPLACE;
run;
data _&i;
set _&i;
length fname $200;
fname="&fname";
run;
%mend impt;
%let path=D:\Sindana\GreatRecession_PM\test\;
data _null_;
length fname $1000 ;
command = "dir &path.*.xls /b";;
infile dummy pipe filevar=command end=eof truncover filename=fname;
do i = 1 by 1 while(not eof);
input path $128.;
path=catt("&path.",path);
put 'NOTE: ' path=;
call execute(cats('%nrstr(%impt)(',path,',',i,',',fname,'));'));
end;
stop;
run; Thank you!
... View more