全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
5896 7
2011-10-20
悬赏 20 个论坛币 已解决
我想用infile的方法导入如附件所示的数据,代码如下:

复制代码

但是导入到SAS中IND8到IND24列的数据无法导入
如果去掉truncover的话,除IND8外所有变量全能导入,但观测值只能导入单号的,不能导入双号的

我不清楚是不是原始数据的行末还有逗号的原因,因为原始数据不方便修改,所以还请问有没有解决的办法

谢谢

data.txt
大小:(85.14 KB)

 马上下载


最佳答案

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2011-10-20 17:00:16
try this one:
复制代码
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-10-21 09:43:38
yugao1986 发表于 2011-10-20 17:00
try this one:
你好,昨天晚上我自己在网上搜了下,也发现了有个lrecl的设定,我当时设到1000就好了。还是要多谢你啊。

还有请问下你设置的delimiter中'2c0d'x代表哪个字符啊?为什么不用','呢?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-10-21 10:16:58
ASCII,这里可能是进制的不同,帮助文档里有这么一段话:“Note:   Any time a text file originates from anywhere other than the local encoding environment, it might be necessary to specify the ENCODING= option on either EBCDIC or ASCII environments.

For example, when you read an EBCDIC text file on an ASCII platform, it is recommended that you specify the ENCODING= option in the INFILE statement. However, if you use the DSD and DLM options in the INFILE statement, the ENCODING= option is a requirement because these options require certain characters in the session encoding (such as quotation marks, commas, and blanks).

The use of encoding-specific informats should be reserved for use with true binary files. That is, files that contain both character and noncharacter fields.  
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-10-21 10:29:58
看看下面的文档,还有相关帖子:
http://support.sas.com/techsup/technote/ts642.html
https://bbs.pinggu.org/thread-1212283-1-1.html
https://bbs.pinggu.org/thread-702705-1-1.html
下面是小例子:
data _null_;
  x='2c0d'x ;
  put x $ascii3.;
run;

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-10-25 14:46:44
楼主提个问题,数据文件还收费,怎么回事啊?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群