0

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 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.