How to combine several binary variables: scenario 1
It is common that we combine several binary variables to be a single variable. For example in medical field, we combine many diseases to be a single variable indicating comorbidity score, which can be further categorized any way that one wishes (for example Charlson Comorbidity Index).
Three steps:
- Dichotomize all diseases as binary variables, which should be coded as 1 or 0, for example disease1 disease2 disease3
- Key step, combine all the dichotomized diseases variables, stata codes: egen comorbidity=rowtotal(disease1 disease2 disease3)
- Categorize the generated variable "comorbidity" as you want