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 351 cluster sampling with unequal probabilities (probability proportional to size sampling)
use https://stats.idre.ucla.edu/stat/books/sop/hospslct.dta, clear svyset [pweight=wstar], psu(drawing) svytotal lifethrt dxdead Survey total estimation pweight: wstar Number of obs = 50 Strata: <one> Number of strata = 1 PSU: drawing Number of PSUs = 5 Population size = 50056 ------------------------------------------------------------------------------ Total | Estimate Std. Err. [95% Conf. Interval] Deff ---------+-------------------------------------------------------------------- lifethrt | 6006.72 1001.12 3227.165 8786.275 .1856061 dxdead | 2002.24 1226.117 -1402.005 5406.485 .765625 ------------------------------------------------------------------------------ svyratio dxdead lifethrt Survey ratio estimation pweight: wstar Number of obs = 50 Strata: <one> Number of strata = 1 PSU: drawing Number of PSUs = 5 Population size = 50056 ------------------------------------------------------------------------------ Ratio | Estimate Std. Err. [95% Conf. Interval] Deff ------------------+----------------------------------------------------------- dxdead/lifethrt | .3333333 .2324056 -.311928 .9785946 1.429167 ------------------------------------------------------------------------------