• 软件SAS
  • 各位SAS高手帮我看一下我做的这个程序有没有什么毛病..谢谢

程序(对数据做主成分分析):

data Wastes;

input City$ ISG HW ISU ISD RISU@@;

cards;

Beijing 1238 10.58 969 91403 67.9

Tianjin 1123 14.96 1153 44 98.3

Shijiazhuang 852 14.45 782 1590 91.8

Taiyuan 2084 2.75 936 509519 44.6

Hohhot 257 2.94 122 465 36.1

Shenyang 475 2.33 330 11136 69.3

Changchun 303 1.88 300 . 98.9

Harbin 946 1.22 705 . 74.5

hanghai 1964 48.77 1892 1233 96.3

Nanjing 1159 21.33 1052 . 87.9

Hangzhou 461 3.53 436 3994 93.9

Hefei 188 1.55 186 22 98.8

Fuzhou 136 0.93 126 112 92.6

Nanchang 154 0.37 135 2343 88.1

Jinan 874 9.19 846 240 94.7

Zhengzhou 691 0.23 467 . 67.6

Wuhan 847 0.73 770 8160 85.4

Changsha 110 . 98 56726 88.1

Guangzhou 540 22.49 520 2485 91.2

Nanning 304 25.26 245 52109 80.5

Haikou 4 0.09 3 268 94.5

Chongqing 1777 13.08 1329 1844955 72.1

Chengdu 424 0.22 401 124830 94.5

Guiyang 657 155.71 290 69613 43.7

Kunming 1132 0.41 451 316990 39.4

Lhasa . . . . .

Xian 125 0.17 117 3407 88.1

Lanzhou 161 11.10 193 2929 96.9

Xining 184 0.45 95 900 48.7

Yinchuan 67 . 63 7087 94.8

Urumqi 343 3.68 247 3286 68.5

;

run;

proc princomp n=5 out=out1;

  var ISG HW ISU ISD RISU;

run;

proc princomp n=5 out=out2 std;

  var ISG HW ISU ISD RISU;

run;

proc print data=out1;

  var prin1-prin5;

run;

proc print data=out2;

  var prin1-prin5;

run;



日志:

622 data Wastes;

623 input City$ ISG HW ISU ISD RISU@@;

624 cards;



NOTE: INPUT 语句到达了行的末尾后,SAS 进入了新的一行。

NOTE: 数据集 WORK.WASTES 有 31 个观测和 6 个变量。

NOTE: DATA 语句 所用时间(总处理时间):

    实际时间       0.01 秒

    CPU 时间       0.00 秒





656 run;

657 proc princomp n=5 out=out1;

658   var ISG HW ISU ISD RISU;

659 run;



WARNING: 7 of 31 observations in data set WORK.WASTES omitted due to missing values.

NOTE: 数据集 WORK.OUT1 有 31 个观测和 11 个变量。

NOTE: PROCEDURE PRINCOMP 所用时间(总处理时间):

    实际时间       0.03 秒

    CPU 时间       0.03 秒





660 proc princomp n=5 out=out2 std;

661   var ISG HW ISU ISD RISU;

662 run;



WARNING: Variable Prin1 has the same name as one of the components. The values in Prin1 will be the component's scores.

WARNING: Variable Prin2 has the same name as one of the components. The values in Prin2 will be the component's scores.

WARNING: Variable Prin3 has the same name as one of the components. The values in Prin3 will be the component's scores.

WARNING: Variable Prin4 has the same name as one of the components. The values in Prin4 will be the component's scores.

WARNING: Variable Prin5 has the same name as one of the components. The values in Prin5 will be the component's scores.

WARNING: 7 of 31 observations in data set WORK.OUT1 omitted due to missing values.

NOTE: 数据集 WORK.OUT2 有 31 个观测和 11 个变量。

NOTE: PROCEDURE PRINCOMP 所用时间(总处理时间):

    实际时间       0.03 秒

    CPU 时间       0.03 秒





663 proc print data=out1;

664   var prin1-prin5;

665 run;



NOTE: 从数据集 WORK.OUT1 读取了 31 个观测。

NOTE: PROCEDURE PRINT 所用时间(总处理时间):

    实际时间       0.00 秒

    CPU 时间       0.00 秒





666 proc print data=out2;

667   var prin1-prin5;

668 run;



NOTE: 从数据集 WORK.OUT2 读取了 31 个观测。

NOTE: PROCEDURE PRINT 所用时间(总处理时间):

    实际时间       0.00 秒

    CPU 时间       0.00 秒
输出:

                                        SAS 系统                   16:36 Wednesday, June 26, 2002 33



                                    The PRINCOMP Procedure



                                  Observations       24

                                  Variables         5





                                    Simple Statistics



                        ISG           HW           ISU           ISD         RISU



            Mean     679.3333333     14.40583333     523.9166667     127168.0417     78.16250000

            StD     601.9849533     32.14277685     471.1257486     384910.0931     21.01152505







                                    Correlation Matrix



                              ISG       HW       ISU       ISD     RISU



                      ISG     1.0000     0.1585     0.9006     0.5396     -.2050

                      HW     0.1585     1.0000     0.1372     -.0173     -.2346

                      ISU     0.9006     0.1372     1.0000     0.3988     0.1327

                      ISD     0.5396     -.0173     0.3988     1.0000     -.2237

                      RISU     -.2050     -.2346     0.1327     -.2237     1.0000







                              Eigenvalues of the Correlation Matrix



                            Eigenvalue   Difference   Proportion   Cumulative



                        1   2.30553325   1.08467538     0.4611     0.4611

                        2   1.22085788   0.27907793     0.2442     0.7053

                        3   0.94177995   0.44550648     0.1884     0.8936

                        4   0.49627347   0.46071803     0.0993     0.9929

                        5   0.03555545               0.0071     1.0000





                                      Eigenvectors



                          Prin1       Prin2       Prin3       Prin4       Prin5



                  ISG     0.634080     0.061164     0.043290     -.314778     0.702312

                  HW     0.158483     -.571655     0.706048     0.385109     0.035785

                  ISU     0.580333     0.303914     0.272277     -.224811     -.667963

                  ISD     0.462657     -.025888     -.514004     0.719241     -.061405

                  RISU     -.148280     0.759234     0.401606     0.429835     0.235651



                                        SAS 系统                   16:36 Wednesday, June 26, 2002 39



                      Obs     Prin1     Prin2     Prin3     Prin4     Prin5



                      1   1.14728   0.04350   0.06497   -0.82712   -0.09292

                      2   0.95005   1.17723   0.96230   -0.35113   -0.12756

                      3   0.25281   0.68447   0.59090   -0.16858   0.00856

                      4   2.62613   -0.62263   -1.06895   -1.04292   0.60413

                      5   -0.85192   -1.60963   -1.14928   -0.82198   -0.38718

                      6   -0.59056   -0.24352   -0.40647   -0.34342   -0.05778

                      7     .       .       .       .       .

                      8     .       .       .       .       .

                      9   2.92843   1.06574   2.15273   -0.77713   -0.17914

                      10     .       .       .       .       .

                      11   -0.65101   0.69147   0.15988   0.11759   0.05397

                      12   -1.29563   0.71500   0.05123   0.44874   0.14331

                      13   -1.38351   0.45801   -0.11943   0.37046   0.09747

                      14   -1.32178   0.31285   -0.21422   0.26216   0.05426

                      15   0.30680   0.92642   0.57116   -0.21684   -0.02963

                      16     .       .       .       .       .

                      17   0.21818   0.68853   0.15113   -0.44327   -0.06836

                      18     .       .       .       .       .

                      19   -0.35360   0.31903   0.58099   0.20531   0.01811

                      20   -0.79211   -0.32159   0.19515   0.36696   0.00784

                      21   -1.69142   0.44883   -0.18235   0.52727   0.13821

                      22   4.24890   0.31985   -1.89469   2.11180   -0.20436

                      23   -0.60841   0.73756   -0.08561   0.35205   0.04419

                      24   0.55908   -3.90764   2.38525   1.00374   0.08558

                      25   0.81969   -1.16555   -1.31140   -0.80786   0.15089

                      26     .       .       .       .       .

                      27   -1.37421   0.30177   -0.23253   0.28550   0.04556

                      28   -1.25146   0.47808   0.22291   0.54050   0.09074

                      29   -1.06275   -1.13492   -0.98458   -0.54219   -0.29559

                      30     .       .       .       .       .

                      31   -0.82897   -0.36286   -0.43908   -0.24965   -0.10032
错误在这个地方:

proc princomp n=5 out=out2 std;

var ISG HW ISU ISD RISU;

run;



你必须指定Data,即:

proc princomp data=Wastes n=5 out=out2 std;

var ISG HW ISU ISD RISU;

run;

如果你不指定Data,那么SAS默认为上一个出现的Data,即用成了out1。
WARNING: 7 of 31 observations in data set WORK.WASTES omitted due to missing values

这句是什么回事呢 我有时也会明明数据集没问题 就是有某一行读不进 是怎么回事啊