全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
6546 3
2009-06-08

请问下面程序 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;

;
二维码

扫码加我 拉你入群

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

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

全部回复
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

二维码

扫码加我 拉你入群

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

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

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                 .

二维码

扫码加我 拉你入群

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

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

2009-6-9 21:45:00
Thank you for detailed illustration. I think what you said does make sense. Appreciate it.
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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