全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2115 1
2011-09-27
导入数据问题:
1.用数据流可以顺利导入
data test;
informat default=$char9. default =8. x6 9.;
input date $ x1-x6;
cards;
2010-1-4        3825.23        3831.02        3750.77        3751.77        31906.64        16077103
2010-1-5        3763.24        3797.68        3698.37        3776.71        50271.99        25252498
2010-1-6        3772.35        3801.51        3751.11        3754.04        46240.42        21974042
2010-1-7        3755.21        3772.98        3664.43        3687.37        43422.88        21170328
2010-1-8        3671.88        3694.32        3633.79        3692.89        32880        16208307
2010-1-11        3834.01        3840.65        3670.34        3689.22        57172        28771342

run;

2.用外部.dat导入出错 (其.dat内容格式与上例cards列出完全相同),请教原因:
data test;
infile 'E:\thesis data\newdata\idx\dc.dat';
informat default=$char9. default =8. x6 9.;
input date $ x1-x6;
run;

839  data test;
840  infile 'E:\thesis data\newdata\idx\dc.dat';
841  informat default=$char9. default =8. x6 9.;
842  input date $ x1-x6;
843  run;


NOTE: The infile 'E:\thesis data\newdata\idx\dc.dat' is:
      File Name=E:\thesis data\newdata\idx\dc.dat,
      RECFM=V,LRECL=256


NOTE: Invalid data for x1 in line 2 1-58.
NOTE: Invalid data for x2 in line 3 1-58.
NOTE: Invalid data for x3 in line 4 1-58.
NOTE: Invalid data for x4 in line 5 1-55.
NOTE: Invalid data for x5 in line 6 1-56.
NOTE: LOST CARD.
NOTE: Invalid data errors for file ''E:\thesis data\newdata\idx\dc.dat'' occurred outside the
      printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
x6=. date=2010-1-4        x1=. x2=. x3=. x4=. x5=. _ERROR_=1 _N_=1
NOTE: 6 records were read from the infile 'E:\thesis data\newdata\idx\dc.dat'.
      The minimum record length was 55.
      The maximum record length was 58.
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.TEST has 0 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

二维码

扫码加我 拉你入群

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

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

全部回复
2011-9-27 15:56:51
可能是那个dat文件的编码引起的。
你查看一下那个文件的编码,然后使用 infile 语句的 encoding= 选项,如 encoding="unicode"。
复制代码


二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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