请选择 进入手机版 | 继续访问电脑版
楼主: springlilac
6063 3

请教一个 data input statement [推广有奖]

  • 0关注
  • 0粉丝

高中生

90%

还不是VIP/贵宾

-

威望
0
论坛币
67 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
967 点
帖子
25
精华
0
在线时间
44 小时
注册时间
2008-1-31
最后登录
2019-1-31

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币

请问下面程序 datalines 里.k  .A  是什么用法。为什么 log 没有 error?

谢谢!

data statepop;

input State $ citypop_80 citypop_90

Noncitypop_80 Noncitypop_90 Region @@;

statepop;

input State $ citypop_80 citypop_90

Noncitypop_80 Noncitypop_90 Region @@;

input State $ citypop_80 citypop_90

Noncitypop_80 Noncitypop_90 Region @@;

datalines;

ME .405 .443 .721 .785 1 NH .535 .659 .386 .450 1

NY 16.144 16.515 1.414 1.475 1 NJ 7.365 7.730 .k .A 1

;

datalines;

ME .405 .443 .721 .785 1 NH .535 .659 .386 .450 1

NY 16.144 16.515 1.414 1.475 1 NJ 7.365 7.730 .k .A 1

;

proc print data=statepop;

print data=statepop;

run;

;
二维码

扫码加我 拉你入群

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

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

关键词:statement Statemen Statem State Input Data statement Input

回帖推荐

yongyitian 发表于3楼  查看完整内容

I guess it is way to assign a missing value for numerical data.  Therefore, missing numbers can be easily identified.  See the following log and printed results.data statepop; input State $ citypop_80 citypop_90 Noncitypop_80 Noncitypop_90 Region @@;datalines; ME .405 .443 .721 .785 1 NH .535 .659 .386 .450 1NY 16.144 16.515 1.414 1.475 1 NJ 7.365 7.730 .k .A 1;data test ;  set stat ...

本帖被以下文库推荐

rdzr 发表于 2009-6-9 08:52:00 |显示全部楼层 |坛友微信交流群

LZ,偶运行了一下你的代码,看错误提示,不知你的LOG里为何没有?

NOTE: SAS initialization used:
      real time           6.75 seconds
      cpu time            0.42 seconds

1    data statepop;
2
3    input State $ citypop_80 citypop_90
4
5    Noncitypop_80 Noncitypop_90 Region @@;
6
7
8
9    statepop;
     --------
     180
ERROR 180-322: Statement is not valid or it is used out of proper order.

10   input State $ citypop_80 citypop_90
11
12   Noncitypop_80 Noncitypop_90 Region @@;
13
14
15   input State $ citypop_80 citypop_90
16   Noncitypop_80 Noncitypop_90 Region @@;
17
18   datalines;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.STATEPOP may be incomplete.  When this step was stopped there were 0
         observations and 6 variables.

NOTE: DATA statement used (Total process time):
      real time           0.09 seconds
      cpu time            0.04 seconds

24   ;


25
26
27   datalines;
     ---------
     180

ERROR 180-322: Statement is not valid or it is used out of proper order.

28   ME .405 .443 .721 .785 1 NH .535 .659 .386 .450 1
     --
     180
ERROR 180-322: Statement is not valid or it is used out of proper order.

29
30   NY 16.144 16.515 1.414 1.475 1 NJ 7.365 7.730 .k .A 1
31
32   ;

33
34   proc print data=statepop;
35
36   print data=statepop;
37   run;

NOTE: No observations in data set WORK.STATEPOP.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.07 seconds
      cpu time            0.00 seconds


38
39   ;

偶把你的程序 改了一下:

data statepop;

input State $ citypop_80 citypop_90

Noncitypop_80 Noncitypop_90 Region @@;

cards;
ME .405 .443 .721 .785 1 NH .535 .659 .386 .450 1

NY 16.144 16.515 1.414 1.475 1 NJ 7.365 7.730 .k .A 1

;
proc print data=statepop;
run;

下去是运行的 Log,注意,一切OK!

84   data statepop;
85
86   input State $ citypop_80 citypop_90
87
88   Noncitypop_80 Noncitypop_90 Region @@;
89
90   cards;

NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.STATEPOP has 4 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


95   ;
96   proc print data=statepop;
97   run;

NOTE: There were 4 observations read from the data set WORK.STATEPOP.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

下面是运行的结果:

                                         The SAS System         08:31 Wednesday, June 9, 2009   3

                          citypop_    citypop_    Noncitypop_    Noncitypop_
          Obs    State       80          90            80             90        Region

           1      ME        0.405       0.443        0.721          0.785          1
           2      NH        0.535       0.659        0.386          0.450          1
           3      NY       16.144      16.515        1.414          1.475          1
           4      NJ        7.365       7.730         K              A             1

使用道具

yongyitian 发表于 2009-6-9 12:04:00 |显示全部楼层 |坛友微信交流群

I guess it is way to assign a missing value for numerical data.  Therefore, missing numbers can be easily identified.  See the following log and printed results.

data statepop;
input State $ citypop_80 citypop_90
Noncitypop_80 Noncitypop_90 Region @@;
datalines;
ME .405 .443 .721 .785 1 NH .535 .659 .386 .450 1
NY 16.144 16.515 1.414 1.475 1 NJ 7.365 7.730 .k .A 1
;
data test ;
  set statepop;
  Noncity8090 = noncitypop_80 + noncitypop_90;
  keep noncitypop_80 noncitypop_90 noncity8090;
run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 76:31
NOTE: There were 4 observations read from the data set WORK.STATEPOP.
NOTE: The data set WORK.TEST has 4 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

proc print data=test; run;

Obs  Noncitypop_80  Noncitypop_90    Noncity8090
1        0.721          0.785          1.506
2        0.386          0.450          0.836
3        1.414          1.475          2.889
4         K                  A                 .

已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

使用道具

Thank you for detailed illustration. I think what you said does make sense. Appreciate it.

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-18 08:07