This is an example of a process that might benefit from creating a macro. Sounds like your existing code is close to being ready to become a macro. Just wrap the existing code into a macro definition that takes FILENAME as a parameter (remove your %let statement).
Then your existing program can become something like this. Where the last line is the one that actually runs the steps defined in the macro definition.
%macro loadfile(filename=);
... existing code ....
%mend loadfile;
%loadfile(filename=file1.csv);
To extend it to loading all files in a directory you just need to generate the list of files and use the list to generate a series of calls to the macro. So something like this might work on a Windows machine. So it will call the Windows command DIR to get the list of files and read the result into a variable and for each file found generate a call to the macro. The commands pushed by CALL EXECUTE will run after the data step finishes.
data _null_;
infile 'dir /b *.csv' pipe truncover ;
input filename $256. ;
call execute(cats('%nrstr(loadfile)(filename=',filename,')'));
run;