f



WARNING or ERROR

Hi friends,

I often use dataset options like KEEP, DROP, RENAME and WHERE.
Sometimes I make a mistake and specify a non-existent variable.
Sometimes I get a warning, sometimes I get an error:
WARNING: The variable _Rater_ in the DROP, KEEP, or RENAME list has never
been referenced.
ERROR: The variable _Rater_ in the DROP, KEEP, or RENAME list has never
been referenced.

The warnings occur with the dataset options in the DATA statement.
The errors occur with the dataset options in the SET statement.
Non-existent variables in the MODIFY statement yields a warning,
while they yield an error in MERGE and UPDATE statements.
However the error with the RENAME option is quite different already,
so the above error text does never apply to the RENAME option!

Furthermore specifying non-existent variable name in a WHERE clause
yields an error, both in the DATA and the SET (and comparable) statements.

I do not understand why the warnings are warnings and
from the viewpoint of consistency between DATA and other statements
I would logically expect all of them to be errors too.

* TEST PROGRAM ;

DATA TestData;
  x = 1;
RUN;

DATA KeepData (KEEP=y);
  SET TestData;
RUN;

DATA DropData (DROP=y);
  SET TestData;
RUN;

DATA RenameData (RENAME=(y=z));
  SET TestData;
RUN;

DATA KeepData;
  SET TestData (KEEP=z);
RUN;

DATA KeepData;
  MODIFY KeepData (KEEP=z);
RUN;

DATA DropData;
  SET TestData (DROP=z);
RUN;

DATA DropData;
  MERGE TestData TestData (DROP=z);
RUN;

DATA RenameData;
  SET TestData (RENAME=(z=y));
RUN;

DATA RenameData;
  UPDATE KeepData TestData (RENAME=(z=y));
  BY x;
RUN;

DATA WhereData (WHERE=(y=1));
  SET TestData;
RUN;

DATA WhereData;
  SET TestData (WHERE=(y=1));
RUN;

I may not have been complete while testing the results of the dataset
options.

Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
0
jim.1stat (180)
12/5/2008 11:10:55 AM
comp.soft-sys.sas 142827 articles. 4 followers. Post Follow

0 Replies
4176 Views

Similar Articles

[PageSpeed] 18

Reply: