The examples below use Stata 8. If you are using Stata version 9, please see this page.
This example is taken from Levy and Lemeshow’s Sampling of Populations.
page 168 stratified random sampling
use https://stats.idre.ucla.edu/stat/books/sop/jacktwn2.dta, clear svyset [pweight=sampwt], strata(stratum) fpc(npop) svytotal twin Survey total estimation pweight: sampwt Number of obs = 831 Strata: stratum Number of strata = 18 PSU: <observations> Number of PSUs = 831 FPC: npop Population size = 256998 ------------------------------------------------------------------------------ Total | Estimate Std. Err. [95% Conf. Interval] Deff ---------+-------------------------------------------------------------------- twin | 26055.4 3791.044 18614.01 33496.78 1.988843 ------------------------------------------------------------------------------ Finite population correction (FPC) assumes simple random sampling without replacement of PSUs within each stratum with no subsampling within PSUs. Weights must represent population totals for deff to be correct when using an FPC. Note: deft is invariant to the scale of weights.
svytotal twin, by(quart1) Survey total estimation pweight: sampwt Number of obs = 831 Strata: stratum Number of strata = 18 PSU: <observations> Number of PSUs = 831 FPC: npop Population size = 256998 ------------------------------------------------------------------------------ Total Subpop. | Estimate Std. Err. [95% Conf. Interval] Deff ---------------+-------------------------------------------------------------- twin | quart1==1 | 19183.8 2661.629 13959.33 24408.28 1.293026 quart1==2 | 6737.907 2696.605 1444.778 12031.04 3.590895 quart1==3 | 133.687 126.7443 -115.0976 382.4715 .3895368 ------------------------------------------------------------------------------ Finite population correction (FPC) assumes simple random sampling without replacement of PSUs within each stratum with no subsampling within PSUs. Weights must represent population totals for deff to be correct when using an FPC. Note: deft is invariant to the scale of weights.