此SAS视图代码中的语法错误在哪里?

时间:2016-08-10 16:08:48

标签: view sas datastep

data work.temp work.error / view = work.temp;  
infile rawdata;  
input Xa Xb Xc;  
if Xa=. then output work.errors;  
else output work.temp;  
run;

它说DATA语句中存在语法错误,但我无法找到...

1 个答案:

答案 0 :(得分:2)

错误是OUTPUT语句中的拼写错误。您正在尝试将观察结果写入ERRORS,但数据语句仅定义ERROR

这是一个奇怪的结构而不是我推荐的东西,但看起来它会起作用。当您行使视图TEMP时,它还会生成数据集ERROR

67   data x; set temp; run;

NOTE: The infile RAWDATA is:
      Filename=...

NOTE: 2 records were read from the infile RAWDATA.
      The minimum record length was 5.
      The maximum record length was 5.
NOTE: View WORK.TEMP.VIEW used (Total process time):
      real time           0.32 seconds
      cpu time            0.01 seconds

NOTE: The data set WORK.ERROR has 1 observations and 3 variables.
NOTE: There were 1 observations read from the data set WORK.TEMP.
NOTE: The data set WORK.X has 1 observations and 3 variables.