Hi All, im very very new to SAS, so hoping someone can help. I have multiple csv files in a folder that i need to create a data set for them. Below is a macro that works perfectly in identifying all the csv files in that folder then creating seperate data sets. %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(H:\Desktop\Other Extracts,csv) How can i create one dataset in that macro above, so all in that one macro to give me one dataset from 6 or 7 or however many csv files are in that folder. NOTE: all have the same number of columns and the columns are the same name, so i can use the top row of any of the files. Im using SAS 9.3 Also, new csv files will be added to that folder (could be monthly, weekly, daily, not sure). How do i integrate this with my data set? Do i simply run it again and again every time there's a new file? (this seems a bit silly) Thanks in advance, appreciate any help or guidance on this.
... View more