Hi, I try to a) create a dataset of non consecutive .csv files in a certain folder b) loop through this dataset and load each file into a master dataset c) add one column to each row that contains the origin (filename) of that row Step (a) works like this: %let servername=\\some\folder\; libname out "&servername.Users\xxxx"; Filename filelist pipe "dir /b \\some\other\folder\*.txt"; Data out.filelist; Infile filelist truncover; Input filename $120.; Run; Step (b) however keeps not using the variable for the filename: data out.completeset_total;
set out.filelist;
do i=1 to 3;
filepath="&servername"||filename;
call symput(fpath,TRIM(filepath));
call symput(fname,TRIM(filename));
put fpath;
filename abc3 "&servername.more\sub\folders\&fpath..txt";
infile abc3 truncover lrecl=1001 firstobs=2 ; input
@1 abc_RS BEST1.
@2 abc_anothercol BEST4.
&fpath.
end;
run; Question: How can I make the filename statement loop through the variable fpath correctly?
... View more