由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - help with reading a strange csv file into SAS
相关主题
reading data into sas 问题我的SAS CODE 错那儿了?
a quick question importing txt into SAS请教, base 50 一个题目,
请问我们平时在SAS里头那种data叫什么format的data呀?R: 怎么读入某个field中含有comma的文件?
修改再问:如何read multiple lines into one record and missing value at the same time in sas偷懒请教一下comma隔开的数字怎么样read进sas成numeric variable
大数据如何在R和sas之间转换R comma between numbers
问个SAS 数据读入的问题小包子:怎么读一个文件中的两个不同的delimiters
问一下SAS base 42题请教一个SAS读中文数据库的问题
where is error in SAS统计新人问个自学SAS的问题
相关话题的讨论汇总
话题: sas话题: field话题: csv话题: comma话题: file
进入Statistics版参与讨论
1 (共1页)
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.

1 (共1页)
进入Statistics版参与讨论
相关主题
统计新人问个自学SAS的问题大数据如何在R和sas之间转换
sas question问个SAS 数据读入的问题
一个很全SAS Interview Q. List [ZT] (转载)问一下SAS base 42题
[合集] Can we calculate log likelihood ratio using SAS???where is error in SAS
reading data into sas 问题我的SAS CODE 错那儿了?
a quick question importing txt into SAS请教, base 50 一个题目,
请问我们平时在SAS里头那种data叫什么format的data呀?R: 怎么读入某个field中含有comma的文件?
修改再问:如何read multiple lines into one record and missing value at the same time in sas偷懒请教一下comma隔开的数字怎么样read进sas成numeric variable
相关话题的讨论汇总
话题: sas话题: field话题: csv话题: comma话题: file