This example is taken from Levy and Lemeshow’s Sampling of Populations.
page 350 cluster sampling with unequal probabilities: probability proportional to size sampling This example uses the hospslct data set.
proc descript data = hospslct filetype=sas design = wr means totals; nest drawing/psulev = 1; weight wstar; var lifethrt dxdead; run;
Number of observations read : 50 Weighted count : 50056 Denominator degrees of freedom : 4 Variance Estimation Method: Taylor Series (WR) by: Variable, One. ----------------------------------------------------- | | | | Variable | | One | | | 1 | ----------------------------------------------------- | | | | | LIFETHRT | Sample Size | 50 | | | Weighted Size | 50056.00 | | | Total | 6006.72 | | | SE Total | 1001.12 | | | Mean | 0.12 | | | SE Mean | 0.02 | ----------------------------------------------------- | | | | | DXDEAD | Sample Size | 50 | | | Weighted Size | 50056.00 | | | Total | 2002.24 | | | SE Total | 1226.12 | | | Mean | 0.04 | | | SE Mean | 0.02 | -----------------------------------------------------
proc ratio data = hospslct filetype = sas design = wr; nest drawing / psulev =1; weight wstar; numer dxdead; denom lifethrt; run;
Number of observations read : 50 Weighted count : 50056 Denominator degrees of freedom : 4 Variance Estimation Method: Taylor Series (WR) by: Variable, One. --------------------------------------------------- | | | | Variable | | One | | | 1 | --------------------------------------------------- | | | | | DXDEAD/LIFETHRT | Sample Size | 50 | | | Weighted Size | 50056.00 | | | Weighted X-Sum | 6006.72 | | | Weighted Y-Sum | 2002.24 | | | Ratio Est. | 0.33 | | | SE Ratio | 0.23 | ---------------------------------------------------
Page 353 cluster sampling with unequal probabilities: probability proportional to size sampling
data hspslct2; set hospslct; /*n is 50*/ /*N_i is admiss*/ /* X is 7087, the total number of life-threating conditions across all the hospitals*/ /*X_i is tl, the total number of life-threating conditions for each hospital*/ if hospno = 2 then tl = 785; if hospno = 5 then tl = 3404; if hospno = 9 then tl = 778; w2star = (admiss/50)*(7087/tl); run; proc descript data = hspslct2 filetype = sas means totals; nest drawing/psulev=1; weight w2star; var lifethrt dxdead; run;
Number of observations read : 50 Weighted count : 51345 Denominator degrees of freedom : 4 Variance Estimation Method: Taylor Series (WR) by: Variable, One. ----------------------------------------------------- | | | | Variable | | One | | | 1 | ----------------------------------------------------- | | | | | LIFETHRT | Sample Size | 50 | | | Weighted Size | 51345.00 | | | Total | 6259.18 | | | SE Total | 1277.32 | | | Mean | 0.12 | | | SE Mean | 0.02 | ----------------------------------------------------- | | | | | DXDEAD | Sample Size | 50 | | | Weighted Size | 51345.00 | | | Total | 1760.47 | | | SE Total | 1079.04 | | | Mean | 0.03 | | | SE Mean | 0.02 | -----------------------------------------------------
proc ratio data = hspslct2 filetype = sas; nest drawing/psulev=1; weight w2star; numer dxdead; denom lifethrt; run;
Number of observations read : 50 Weighted count : 51345 Denominator degrees of freedom : 4 Variance Estimation Method: Taylor Series (WR) by: Variable, One. --------------------------------------------------- | | | | Variable | | One | | | 1 | --------------------------------------------------- | | | | | DXDEAD/LIFETHRT | Sample Size | 50 | | | Weighted Size | 51345.00 | | | Weighted X-Sum | 6259.18 | | | Weighted Y-Sum | 1760.47 | | | Ratio Est. | 0.28 | | | SE Ratio | 0.21 | ---------------------------------------------------