|
%macro import_all_countries (path =, filename= , in =, out = ,
fileout=);
filename &in "&path&filename";
filename &out "&path&fileout";
data _null_ ;
length result header $ 256;
infile &in /*end = eof*/;
file &out ;
result=" ";
input ;
if _N_ eq 1 then do;
result = substr (_infile_, indexc(_infile_, '"'), length(_infile_) -
(indexc(_infile_, '"') -1));
header = scan(_infile_, 1, '"') ;
header = '"'||compress(tranwrd(header,',','"'||'09'x||'"'),'
')||'"';
put header;
put result;
end;
else /*if _N_ < 4 then */
put _infile_;
run;
proc import datafile= "&out" out=work.test dbms=dlm replace;
delimiter = '09'x;
getnames = yes;
GUESSINGROWS=3276;
run;
%mend import_all_countries ;
%Let path =J:\Tobedeletedby060531\;
%Let filename =demo_quarterly_spool_AU.dat;
%Let in = AU_demos;
%Let out = AU_cleaned;
%Let fileout =SE_demos_cleaned.dat;
%import_all_countries (path = &path, filename = &filename, in = &in,
out = &out , fileout = &fileout);
And this is the error in the log.
ERROR: Invalid logical name.
ERROR: Error in the FILENAME statement.
I really don't understand why there's a restriction on the filename...
Did someone encounter a similar problem?
|