为什么分析图不会随我的代码一起弹出?

时间:2019-04-24 08:27:46

标签: sas

我正在尝试分析调查数据,但是SAS软件似乎无法运行我要查找的图形。

我做错了什么?

ODS HTML CLOSING;

ODS LISTING;

OPTIONS NODATE NONUMBER LS=78 PS=50;

DATA A;

INPUT X1    X2  X3  X4  X5  X6  X7  X8  X9  X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30;

CARDS;

2,3,3,3,2,3,4,4,3,3,2,3,2,4,4,4,4,3,3,3,5,5,5,4,4,5,3,4,4,4

2,2,3,2,2,2,2,4,2,2,2,3,2,4,4,5,4,4,2,2,5,5,5,4,4,5,3,4,4,4

2, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

PROC PRINCOMP DATA=A OUT=OUT2;

VAR X1  X2  X3  X4  X5  X6  X7  X8  X9  X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30;

RUN;

PROC PRINTDATA=OUT2;

RUN;

PROC CORR DATA=OUT2;

VAR X1  X2  X3  X4  X5  X6  X7  X8  X9  X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30;

WITH PRIN1 PRIN2;

RUN;

proc plot data=out2;

plot prin2*prin1

run;

谢谢。

1 个答案:

答案 0 :(得分:0)

名义上,INPUT的默认值分隔符是一个空格。

CARDS数据用逗号分隔时,DATA步骤将需要一个INFILE语句,该语句指定如何解析(以及输入语句)输入行。

您还应该学习如何使用变量列表,例如VAR1-VAR30

DATA WANT;

  INFILE CARDS 
    DELIMITER=','    /* values are separated by comma */
    MISSOVER         /* if not enough values in the input line the remaining variables are assigned missing */
  ;

  INPUT X1-X30;  /* grab value for 30 variables */
CARDS;
2,3,3,3,2,3,4,4,3,3,2,3,2,4,4,4,4,3,3,3,5,5,5,4,4,5,3,4,4,4
2,2,3,2,2,2,2,4,2,2,2,3,2,4,4,5,4,4,2,2,5,5,5,4,4,5,3,4,4,4
2, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
run;