* 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
svyset fpc birth
svymean momsag

svyset, clear
svyset
ci momsag
di sqrt((773-25)/773)*.0553775
* fpc multiplied by the standard error for mean

svyset pweight weight1
svyset 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
svyset strata oblevel
svyset fpc tothosp
svytotal births

svytotal births, by (oblevel)

* one-stage cluster sampling

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
svyset fpc M
svyset psu devlpmnt
svytotal NVSTNRS NGE65

svymean NVSTNRS hhneedvn

svyratio NVSTNRS NGE65
