I have used the search function to look at other posts but am struggling to find an answer to my problem. I am trying to import all CSV files that exist within a directory using the code found here: https://documentation.sas.com/?docsetId=mcrolref&docsetTarget=n0ctmldxf23ixtn1kqsoh5bsgmg8.htm&docsetVersion=9.4&locale=en %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,csv) However, I am getting the following error message and cannot figure out where I'm going wrong: WARNING: Apparent symbolic reference CSV not resolved. The only part of the code I am updating is %drive(c:\temp, csv) to change c:\temp to my directory location where the csv files are located. All the CSV files have the same 5 variables and are in the same format. I am relatively new to SAS, but am hoping to utilize a macro as I have multiple CSV files to combine for several projects. Thank you in advance and please let me know if I can provide additional information.
... View more