首页 > 解决方案 > 错误说没有给出变量 X,但变量 x 是在之前声明的

问题描述

尝试在 SAS 中绘制它时出现错误,错误表示未给出变量 X,但变量 x 之前已声明。

这是我的代码:

data prg7_5;
do a=1 to 3;
input x@@;
output
end;
cards;
7028 1764 600 7228 2036 744 
7228 2130 804 8448 2536 844
8567 2436 912 9061 2436 1128 
9167 3108 1320 9167 3108 1464 
10032 3108 1608 10051 3208 1896
;
run;
goptions hsize=5 vsize=4 ftext='宋体';
footnote 'the time ';
symbol1 interpol=boxt00 width=1.8 bwidth=5 co=red;
axis1 label  =('temperature(C)')
    value=('190' ' 220 ' '260')
    minor=none
    offset=(10,10);
axis2 label =(angle=90'the time')
    offset=(0,0);
proc gplot data= prg7_5;
    plot x*a/haxis=axis1
        vaxis=axis2;
run;

这是运行日志: 在此处输入图像描述 你能告诉我正确的方法吗?请帮忙

标签: sas

解决方案


输出后需要一个分号。您的数据集将为空,并且您有以下错误。

  ERROR 117-185: There was 1 unclosed DO block.

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

在输出中用分号更改代码,如下所示

 do a=1 to 3;
  input x@@;
  output;
 end;

推荐阅读