DATA Step, Macro, Functions and more


Frequent Contributor
Posts: 82



I know that there is such a MERGENOBY option. Is there also something similar that would work something like SET NO BY but, for example, just in cases if you use FIRST.variable or LAST.variable? (Option that would not let you use first.variable if you don't use BY statement?)

Seems too complicated to really have such, but maybe you know some trick how not to forget BY statement in such cases Smiley Happy

Valued Guide
Posts: 2,191

Re: mergenoby

no options seem to support this (although I think there is a SAS92 feature which would convert a lot of NOTE messages into ERROR or WARNING).
If you want a quick check, search for strings
"NOTE: Variable first." and "NOTE: Variable last."
could be worth a ballot item or "Suggestion" at

Respected Advisor
Posts: 3,852

Re: mergenoby

The undocumented DSOPTIONS may be useful.

120 options dsoptions=note2err;
121 data test;
122 set sashelp.class;
123 if then;
124 run;

ERROR: Variable is uninitialized.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEST may be incomplete. When this step was stopped there were 0
observations and 5 variables.
WARNING: Data set WORK.TEST was not replaced because this step was stopped
Frequent Contributor
Posts: 82

Re: mergenoby

Posted in reply to data_null__
Great thanks Peter and data _null_! That is the option I was searching for.
Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation