Incorrect results are possible when the TOTAL= or N= data set is the same as the DATA= data set in PROC SURVEYMEANS


If your sample design is stratified with different population totals in the strata and the totals are read into PROC SURVEYMEANS using the _TOTAL_ variable from the same TOTAL= or N= input data set as the DATA= input data set, the results will be incorrect if a class variable is analyzed and any strata have all missing values for that class variable. Either many of the computed statistics, including variances, will be incorrect without warning, or you may get:

ERROR: Population total X for stratum Y in data set &ltdata set name&gt is smaller than the sample size Z.

when, in fact, none of your _TOTAL_ values are smaller than the sample size in any stratum.

To circumvent this problem, use a different TOTAL= or N= data set than the DATA= data set. The TOTAL= or N= can be easily created as a copy of the DATA= . For example, if your DATA= data set is called ONE, then instead of

proc surveymeans data=one total=one;

do the following:

data pop_totals;
   set one;
   run;
proc surveymeans data=one total=pop_totals;