Andrei Jirnyi
2012-05-07 20:47:26 UTC
Is there any way to use proc import to import a .csv file, where
several variables contain longish text fields with commas in them
(enclosed in quotes, possibly containing newlines and literal quotes
escaped by doubling)? e.g. if I have:
# test.csv:
a,b,c
1, "some text", 11
2, "some, more, text", 22
3, "yet some, ""quoted text"" with, commas", 33
# test.sas:
proc import datafile="test.csv" out=test dbms=csv;
run;
proc print data=test;
run;
I get garbage:
# test.lst
Obs a b c
1 1 some text 11
2 2 some, more, 22
3 3 yet some, " 33
4 .
Obs VAR4 VAR5
1 .
2 .
3 .
4 .
several variables contain longish text fields with commas in them
(enclosed in quotes, possibly containing newlines and literal quotes
escaped by doubling)? e.g. if I have:
# test.csv:
a,b,c
1, "some text", 11
2, "some, more, text", 22
3, "yet some, ""quoted text"" with, commas", 33
# test.sas:
proc import datafile="test.csv" out=test dbms=csv;
run;
proc print data=test;
run;
I get garbage:
# test.lst
Obs a b c
1 1 some text 11
2 2 some, more, 22
3 3 yet some, " 33
4 .
Obs VAR4 VAR5
1 .
2 .
3 .
4 .