This example is taken from Levy and Lemeshow’s Sampling of Populations.
page 198 ratio estimation This example uses the tab7pt1 data set. Note that there may be a typo in the text for the weighted X-sum and the weighted Y-sum. The ratio can be calculated by dividing the two sums, yielding 0.3191. However, the standard error cannot be calculated in that manner.
proc surveymeans data = tab7pt1 n = 8 sum ; weight wt1; var pharmexp totmedex; run;The SURVEYMEANS Procedure Data Summary Number of Observations 7 Sum of Weights 8 Statistics Variable Sum Std Dev ---------------------------------------- PHARMEXP 1028571 58612 TOTMEDEX 3222857 150771 ----------------------------------------
This example is taken from Lehtonen and Pahkinen’s Practical Methods for Design and Analysis of Complex Surveys.
The code below gives the numbers that are shown in the calculations on page 102.
data page102; input id str clu wt ue91 hou85 gwt adjwt smplrat; fpc = 32; datalines; 1 1 1 4 4123 26881 .5562 2.2248 .25 2 1 4 4 760 4896 .5562 2.2248 .25 3 1 5 4 721 3730 .5562 2.2248 .25 4 1 15 4 142 556 .5562 2.2248 .25 5 1 18 4 187 1463 .5562 2.2248 .25 6 1 26 4 331 1946 .5562 2.2248 .25 7 1 30 4 127 834 .5562 2.2248 .25 8 1 31 4 219 932 .5562 2.2248 .25 ; run;
NOTE: 6610/41238 = .16028905, which is the correct answer.
proc surveymeans data = page102 r = .25 sum std; weight wt; cluster clu; strata str; var ue91 hou85; run;The SURVEYMEANS Procedure Data Summary Number of Strata 1 Number of Clusters 8 Number of Observations 8 Sum of Weights 32 Statistics Variable Sum Std Dev ---------------------------------------- ue91 26440 13282 hou85 164952 87299 ----------------------------------------
The goal is to get the .1603 shown in the upper middle of page 102. You need this ratio estimate so that you can multiply it by the population total of the auxiliary variable to calculate the ratio estimate for the total of the variable of interest.