* Simple random sampling

use http://www.ats.ucla.edu/stat/books/sop/momsag.dta, clear
list birth weight1 momsag in 1/10
svyset [pweight = weight1], fpc(birth)
svymean momsag

svyset, clear
svyset
ci momsag
display sqrt((773-25)/773)*.0553775
* fpc multiplied by the standard error for mean

svyset [pweight = weight1], fpc(birth)
svytotal momsag

* Stratified random sampling

use http://www.ats.ucla.edu/stat/books/sop/hospsamp.dta, clear
list in 1/10
svyset [pweight = weighta], strata (oblevel) fpc (tothosp)
svytotal births

svytotal births, by (oblevel)

use http://www.ats.ucla.edu/stat/books/sop/tab9_1a.dta, clear
list devlpmnt  HH wt1 M NVSTNRS NGE65 hhneedvn in 1/10
svyset [pweight = wt1], fpc(M) psu (devlpmnt)
svytotal NVSTNRS NGE65

svymean NVSTNRS hhneedvn

svyratio NVSTNRS NGE65
