Hi, I have trouble in reading a csv file in SAS, because comma exists in a string, which should be one column.
The CSV file is like below:
id,x1,x2,text,dt,x3,x4,x5,x6
101,"","","VISTOR said, \"good."\",2022-11-03,0,0,x,y
310380,2,Inf,"Flu, but not get it yet, but said \"don't want it\". Education provided.",2022-11-04,"","",0,0
My code:
data aa;
infile
"c:\test.csv"
MISSOVER DSD lrecl=40000 firstobs=2 TERMSTR=CRLF delimiter= ',' ;
informat id $20. ;
informat x1 $10. ;
informat x2 $10. ;
informat text $300. ;
informat dt $10. ;
informat x3 $2. ;
informat x4 $2. ;
informat x5 $2.;
informat x6 $2.;
format id $20. ;
format x1 $10. ;
format x2 $10. ;
format text $300. ;
format dt $10. ;
format x3 $2. ;
format x4 $2. ;
format x5 $2. ;
format x6 $2.;
input
id $
x1 $
x2 $
text $
dt $
x3 $
x4 $
x5 $
x6 $
;
run;
Then the output is messed up and like :
How do I fix this?
Thanks
... View more