Hi all, I am trying to import multiple csvs, from multiple folders, where the folder name increments by 1 each day. Is there a way I can import multiple CSVs where the folder each day increments by 1? For ex: Day1 = C:temp\00001 Day = C:temp\00002 end ex: I found a macro that will import multiple CSVs from the same directory but I can't figure out how to import from multiple directories code below to pull all CSV from same dir.... %macro drive(dir,ext); %local cnt filrf rc did memcnt name; %let cnt=0; %let filrf=mydir; %let rc=%sysfunc(filename(filrf,&dir)); %let did=%sysfunc(dopen(&filrf)); %if &did ne 0 %then %do; %let memcnt=%sysfunc(dnum(&did)); %do i=1 %to &memcnt; %let name=%qscan(%qsysfunc(dread(&did,&i)),-1,.); %if %qupcase(%qsysfunc(dread(&did,&i))) ne %qupcase(&name) %then %do; %if %superq(ext) = %superq(name) %then %do; %let cnt=%eval(&cnt+1); %put %qsysfunc(dread(&did,&i)); proc import datafile="&dir\%qsysfunc(dread(&did,&i))" out=dsn&cnt dbms=csv replace; run; %end; %end; %end; %end; %else %put &dir cannot be open.; %let rc=%sysfunc(dclose(&did)); %mend drive; %drive(C:Temp\_20191101-000031,csv) code below to try and add pull from multiple dir at same time.... %macro test; %do i = 30 %to 31; %drive("C:temp\-0000&i,csv"); %end; %mend; %test
... View more