Hi friends, I am trying to import couple of CSV files from a folder and I am using attached code but import process is getting failed because CSV file has multiple different characters like (**, ***, ****, -, _, (X), N). Is there any way to twist this code so I can get it done? I want to replace all different character with dot (.). Can you please help? Thanks. /*This is a code i am using*/ %macro drive(dir,ext); %let filrf=mydir; /* Assigns the fileref of mydir to the directory and opens the directory */ %let rc=%sysfunc(filename(filrf,&dir)); %let did=%sysfunc(dopen(&filrf)); /* Returns the number of members in the directory */ %let memcnt=%sysfunc(dnum(&did)); /* Loops through entire directory */ %do i = 1 %to &memcnt; /* Returns the extension from each file */ %let name=%qscan(%qsysfunc(dread(&did,&i)),-1,.); /* Checks to see if file contains an extension */ %if %qupcase(%qsysfunc(dread(&did,&i))) ne %qupcase(&name) %then %do; /* initialize variable */ %let dslist=; /* Checks to see if the extension matches the parameter value */ /* If condition is true prints the full name to the log */ %if (%superq(ext) ne and %qupcase(&name) = %qupcase(&ext)) or (%superq(ext) = and %superq(name) ne) %then %do; %let file= %qsysfunc(dread(&did,&i)); %let dslist=&dslist %scan(&file,1,.); Proc import datafile="&dir.%unquote(&file)" out=%scan(%unquote(&file),1,.) dbms=csv; getnames=yes; run; %end; %end; %end; /* Closes the directory */ %let rc=%sysfunc(dclose(&did)); %mend drive; /* First parameter is the directory of where your files are stored. This value must end with a '\' ! */ /* Second parameter is the extension you are looking for. */ %drive(\\xyz\census economic\,csv)
... View more