In the past I used a macro (following the progra from some website that I don't remember). This actually helps.
Please change the macro to cater for your requirement. This is just a guide line.
%macro fileloc(filein);
%let outfilepath=myoutfilepath ;*outfile path name;
%let SourceDatapath=mysourcedata ;*sourcedata path name;
%let filrf=mydir;
%let rc=%sysfunc(filename(filrf,"&root_dir\Source Data\Online Source Data"));
%let did=%sysfunc(dopen(&filrf));
%let fname=;
%let memcount=%sysfunc(dnum(&did));
%if &memcount > 0 %then
%do i=1 %to &memcount;
%let fname=%sysfunc(dread(&did,&i));
%let iw=%index(&fname,.);
%let loc=%substr(&fname,1,%eval(&iw-1)); /* get first part of file name */
filename dr "&SourceDatapath\&fname.";
filename outfile "&outfilepath\&fname."; /* use file name to determine;
directory for output file */
run;
PROC IMPORT OUT= WORK.A
DATAFILE= "&sourcedatapath\&fname."
DBMS=TAB REPLACE;
GETNAMES=No;
DATAROW=1;
RUN;
%end;
%let rc=%sysfunc(dclose(&did));
%mend fileloc;
%fileloc(&filein1);