Info iconIMPORTANT NOTE

These programs use variable formats listed in the Tutorial Formats page. You may need to format the variables in your dataset the same way to reproduce results presented in the tutorial.

Use the xi command to expand terms containing categorical variables into indicator (also
called dummy) variable sets. Use the svy: logit command to perform multiple logistic regressions to assess the association between hypertension and multiple risk factors, including: age, gender, high cholesterol, body mass index, and fasting triglycerides. Use the subpop( ) option to select a subpopulation for analysis, rather than select the study population in the Stata program while preparing the data file. Use the or option to produce estimates as odds ratios.

Stata Multivariate Logistic Procedure
Statements Explanation
use "C:\Stata\tutorial\analysis_data.dta", clear

Use the use command to load the Stata-format dataset. Use the clear option to replace any data in memory.

svyset sdmvpsu [pweight=wtsaf4yr], strata(sdmvstra) vce(linearized)

Use the svyset command to declare the survey design for the dataset. Specify the psu variable sdmvpsu. Use the [pweight=] option to account for the unequal probability of sampling and non-response. In this example, the MEC fasting weight for four years of data (wtsaf4yr) is used. Use the strata () option to specify the stratum identifier (sdmvstra). Use the vce( ) option to specific the variance estimation method (linearized) for Taylor linearization.

char age[omit] 2
 char riagendr[omit]2
 char bmigrp[omit] 2
char hichol[omit]1

Use these options to choose your reference group for the categorical variables. For example, the 2nd age category (age 40-59) is chosen as the reference group.

If you do not specify the reference group options, Stata will choose the lowest numbered group by default.

xi: svy, subpop(if ridageyr >=20) vce(linearized): logit hyper i.age i.riagendr i.hichol i.bmigrp logtrig

 

Use the xi command to expand terms containing categorical variables (denoted i.varname) into indicator (also called dummy) variable sets. Use the svy: logit command to perform multiple logistic regressions to assess the association between hypertension and multiple risk factors, including: age, gender, high cholesterol, body mass index, and fasting triglycerides. Use the subpop( ) option to select a subpopulation for analysis, rather than select the study population in the Stata program while preparing the data file. (Note: omission of the or option as shown below will yield estimates as coefficients.)

xi: svy, subpop(if ridageyr >=20) vce(linearized): logit hyper i.age i.riagendr i.hichol i.bmigrp logtrig, or

test 

*******************************

test _Iage_1 _Iage_3, nosvyadjust

test _Iriagendr_1, nosvyadjust

test _Ihichol_0, nosvyadjust

test _Ibmigrp_1 _Ibmigrp_3, nosvyadjust

test logtrig, nosvyadjust  

Use the test postestimation command to produce the Wald F statistic and the corresponding p-value. Use the nosvyadjust option to produce the unadjusted Wald F. In the example, the command test is used to test all coefficient together and then all coefficients separately.

 

warning iconWARNING

The Stata command, svy:logit, produces the adjusted and unadjusted Wald statistic and its p value. It does not produce the Satterthwaite χ2 or the Satterthwaite F and the corresponding p values recommended for NHANES analyses.

 

close window icon Close Window