-1
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;

It says there's a syntax error in the DATA statement, but I can't find where ...

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
dayaoyao
  • 120
  • 2
  • 9

1 Answers1

2

The error is a typo in the OUTPUT statement. You are trying to write observations to ERRORS but the data statement only defined ERROR.

It is a strange construct and not something I would recommend, but it looks like it will work. When you exercise the view TEMP it will also generate the dataset 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.
Tom
  • 47,574
  • 2
  • 16
  • 29