|
Chapter Contents |
Previous |
Next |
| The SURVEYMEANS Procedure |


PROC SURVEYMEANS calculates the degrees of freedom for the t test as the number of clusters minus the number of strata. If there are no clusters, then df equals the number of observations minus the number of strata. If the design is not stratified, then df equals the number of clusters minus one. The procedure displays df for the t test if you specify the keyword DF in the PROC SURVEYMEANS statement.
If missing values or missing weights are present in your data, the number of strata, the number of observations, and the number of clusters are counted based on the observations in non-empty strata. See the section "Missing Values" for details. For degrees of freedom in domain analysis, see the section "Domain Analysis".
For a domain D, let ID be the corresponding indicator variable:

Let

The requested statistics for variable y in domain D are computed based on the values of z.
Domain Mean The estimated mean of y in the domain D is

where

The variance of
is estimated by


Domain Total The estimated total in domain D is



Degrees of Freedom For domain analysis, PROC SURVEYMEANS computes the degrees of freedom for t tests as the number of clusters in the non-empty strata minus the number of non-empty strata. When the sample design has no clusters, the degrees of freedom equals the number of observations in non-empty strata minus the number of non-empty strata. As discussed in the section "Missing Values", missing values and missing weights can result in empty strata. In domain analysis, an empty stratum can also occur when the stratum contains no observations in the specified domain. If no observations in a whole stratum belong to a domain, then this stratum is called an empty stratum for that domain.
For example,
data new;
input str clu y w d;
datalines;
1 1 . 40 9
1 2 2 . 9
1 3 . 25 9
2 4 5 20 9
2 5 8 15 9
3 6 5 30 7
3 7 9 89 7
3 8 6 23 7
;
proc surveymeans df nobs nclu nmiss;
strata str;
cluster clu;
var y;
weight w;
domain d;
run;
Table 13.2: Calculations of df for Y | Domain D=7 | Domain D=9 | |
| Non Empty Strata | STR=3 | STR=2 |
| Clusters Used in the Analysis | CLU=6, CLU=7, and CLU=8 | CLU=4 and CLU=5 |
| df | 3-1=2 | 2-1=1 |
Although there are three strata in the data set, STR=1 is an empty stratum for variable Y because of missing values and missing weights. In addition, no observations in stratum STR=3 belong to domain D=9. Therefore, STR=3 becomes an empty stratum as well for variable Y in domain D=9. As a result, the total number of non-empty strata for domain D=9 is one. The non-empty stratum for domain D=9 and variable Y is stratum STR=2. The total number of clusters for domain D=9 is two, which belong to stratum STR=2. Thus, for variable Y in domain D=9, the degrees of freedom for the t tests of the domain mean is df=2-1=1. Similarly, for domain D=7, strata STR=1 and STR=2 are both empty strata, so the total number of strata is one (STR=3), and the total number of clusters is three ( CLU=6, CLU=7, and CLU=8). Table 13.2 illustrates how domains affect the total number of clusters and total number of strata in the df calculation. Figure 13.1 shows the df computed by the procedure.
| |||||||||||||||||||||||||
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 2000 by SAS Institute Inc., Cary, NC, USA. All rights reserved.