I have a similar situation. The structure of the files is the same, but the file names are random, and over time, more files are added.
This program uses the x command to go to Windows and generate a file with the names of all *.csv files in a directory. Then control comes back to SAS, and the INFILE statement uses the generated file with the FILEVAR option to read and stack the files.
All you need to know to use this method is the directory and filetype.
I left the length and input statements as is so you could see the structure.
Wendy
filename par_files 'D:\yada\my_files.sas' ;
x 'cd D:\yada\my_directory' ;
x 'del my_files.sas' ;
x 'dir *.csv /a-d /B /L > my_files.sas' ;
x 'exit' ;
DATA PAR_FILES ;
LENGTH
READFILE $ 200
STATION $ 20
PAR1_ $ 10
PAR2_ $ 10
PAR3_ $ 10 ;
FORMAT SASDATE YYMMDD6. ;
INFILE PAR_FILES ;
INPUT READFILE $ ;
INFILE FILE FILEVAR=READFILE END=DONE MISSOVER PAD LRECL=900 FIRSTOBS=4 DLM=',' ;
DO UNTIL (DONE) ;
INPUT
STATION $ SASDATE YYMMDD8. TIME1 REP SET DPTHSTR PAR_K
DPTHCOL1 PAR1 PAR1_ $
DPTHCOL2 PAR2 PAR2_ $
DPTHCOL3 PAR3 PAR3_ $ ;
OUTPUT ;
END ;
RUN ;