楼主: freezeyouth
2141 1

[原创博文] 数据导入问题 [推广有奖]

  • 0关注
  • 0粉丝

已卖:6份资源

高中生

80%

还不是VIP/贵宾

-

威望
0
论坛币
1 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
299 点
帖子
18
精华
0
在线时间
26 小时
注册时间
2008-2-14
最后登录
2014-5-5

楼主
freezeyouth 发表于 2011-9-27 15:13:24 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
导入数据问题:
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

二维码

扫码加我 拉你入群

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

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

关键词:数据导入 observations observation statement Available default 数据流

沙发
YueweiLiu 发表于 2011-9-27 15:56:51
可能是那个dat文件的编码引起的。
你查看一下那个文件的编码,然后使用 infile 语句的 encoding= 选项,如 encoding="unicode"。
  1. data test;
  2.         infile 'E:\thesis data\newdata\idx\dc.dat' encoding="unicode";
  3.         informat default=$char9. default =8. x6 9.;
  4.         input date $ x1-x6;
  5. run;
复制代码


您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 00:22