Stata 15 help for _svy_setup


[SVY] _svy_setup -- Retrieve svy settings and adjust weights


_svy_setup markvar submarkvar [wvar] [weight] [, cmdname(name) subpop(subpop, ...) over(varlist, ...) srssubpop stset ]

weights are not allowed but are indicated above for the purpose of generating an informative error message for the calling routine.


_svy_setup is a programmers' tool for retrieving the required information for survey data analysis. _svy_setup will display an error message if the data are not currently svyset.

markvar is a mark variable as described in [P] mark. This variable identifies the subset of the data that will be used for estimation purposes.

submarkvar is a new variable name and will identify the subpopulation observations defined by markvar and the subpop() and over() options.

wvar is a new variable name and, if specified, will be filled in with the observation-level weights.


cmdname(name) identifies the name of the calling routine, and is used to identify commands that allow the over() option.

subpop(subpop, ...) identifies the subpopulation; see [SVY] svy.

srssubpop is sometimes allowed outside the subpop() option; see [SVY] svy.

over(varlist, ...) identifies multiple subpopulations. This option along with the cmdname() option help provide better error messages for syntax errors in specifying subpopulations.

stset verify that the stset settings are consistent with those of svyset.


. _svy_setup touse subuse wvar, cmdname(mean)

Stored results

In addition to the results documented in [SVY] svyset, _svy_setup stores the following in r():


r(N) the number of selected observations r(N_pop) the population size r(N_strata) the number of strata r(N_psu) the number of PSUs r(N_sub) the number of selected subpopulation observations r(N_subpop) the subpopulation size r(N_subpsu) the subpopulation PSUs


r(subpop) the parsed subpop() option r(srssubpop) the parsed srssubpop option

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index