06-24-2013 06:08 PM
I would like to use PROC IMPORT and force all variables to character. Since I am reading CSV files, I cannot use the MIXED= option.The attributes of the files are unknown and I am hoping that I will not have to build something to parse them individually.
06-24-2013 07:03 PM
I have never seen such an option.
How hard do you want to work to import the file(s)? Are you willing to accept that all variables are the same length? If so then read the first line into a macro variable that you can use as the list of variable names.
infile tmpfile1 obs=1 ;
call symputx('varlist',translate(_infile_,' ',','));
data want ;
infile tmpfile1 dsd firstobs=2 truncover ;
length &varlist $200 ;
input &varlist ;
06-24-2013 09:01 PM
I am afraid that is hard for proc import . As Tom mentioned There is not an option to control it. The only thing I can think is about modify that csv file and import it.
data _null_; infile 'c:\temp\x.csv' ; file 'c:\temp\temp.csv'; input; _infile_=tranwrd(cats(_infile_,'09'x),',',cats('09'x,',')); put _infile_; run; proc import datafile='c:\temp\temp.csv' out=x dbms=csv replace;run;
Message was edited by: xia keshan
06-25-2013 01:24 PM
Not exactly main stream. Might be a good TRANSPOSE example;