n***p 发帖数: 508 | 1 I have a comma delimited file (.csv) and it is more than 210,000 rows. I
need to read it into sas, but I have a problem here. One text field in the
csv file is sometimes a long text string with commas in it. one example is
like this, please look at the content between "previous_field" and "next_
field":
previous_field,"CANCELLATION WITH REFUND AS PER TRACKER RECEIVED ON 16/04/08
.Nothing constrained shall be held to vary, alter, waive or change any of
the insuring agreements, exclusions, conditions or declarations of the
policy, except as herein above set forth",next_field,
Since this file is comma delimited, and this one field in itself has commas.
I encountered error messages when I use import in SAS. I also tried to
change it to ACCESS and EXCEL, but it does not help. please let me know if
you have any solutions to this problem.
thank you very much! | d**********r 发帖数: 24123 | 2 is it normal when open it in Excel?
And what is the error message? | n***p 发帖数: 508 | 3 what do you mean by normal? it is the same as a in csv
as this string has comma in it, then sas will treat the first part of the
string (up until the first comma) as the value of the variable, then it
bascially mess up other variables afterwards.
【在 d**********r 的大作中提到】 : is it normal when open it in Excel? : And what is the error message?
| d**********r 发帖数: 24123 | 4 I tried your example. The comma dont cause any problem. The problem here is
the invisible [Return]s:
previous_field,"CANCELLATION WITH REFUND AS PER TRACKER RECEIVED ON 16/04/08<--------------here
.Nothing constrained shall be held to vary, alter, waive or change any of <- | s******y 发帖数: 352 | 5 you need to specify option DSD in your infile statement. by default, the
double quotation marks will be stripped off. in order to retain the
quotation marks as part of the value, use the tilde (~) format modifier in
an INPUT statement.
08
commas.
【在 n***p 的大作中提到】 : I have a comma delimited file (.csv) and it is more than 210,000 rows. I : need to read it into sas, but I have a problem here. One text field in the : csv file is sometimes a long text string with commas in it. one example is : like this, please look at the content between "previous_field" and "next_ : field": : previous_field,"CANCELLATION WITH REFUND AS PER TRACKER RECEIVED ON 16/04/08 : .Nothing constrained shall be held to vary, alter, waive or change any of : the insuring agreements, exclusions, conditions or declarations of the : policy, except as herein above set forth",next_field, : Since this file is comma delimited, and this one field in itself has commas.
|
|