0
votes

I wrote a code in unix SAS to import multiple csv files from current folder. The macro variables are being assigned correct values but somehow the relevant files are not being imported. I am getting the following error message

ERROR: Physical file does not exist, /work/pricepromo/modeler/tolapa01/pawan/&j..csv. ERROR: Import unsuccessful. See SAS Log for details.

Below is the code.

OPTIONS MERROR MPRINT SERROR MLOGIC SYMBOLGEN ;
X ls *.csv > list;

data name    ;
infile 'list' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=1 ;
   informat name_list $9. ;
   format name_list $9. ;
input
            name_list $
;
run;

data name2;
set name;
name_mod=translate(name_list,'','.csv');
run;

proc sql;
select name_mod into :name separated by '*' from name2;
%let count2 = &sqlobs;
quit;


%macro yy;
%do i = 1 %to &count2;
%let j = %scan(&name,&i,*);
proc import out = &j datafile='./&j..csv'
dbms=csv replace;
run;
%end;
%mend;

%yy;
1

1 Answers

1
votes

Try using double quotes

datafile="./&j..csv"

not

datafile='./&j..csv'

With all those options it should have been obvious from reading the SAS log.