
use doi hs01 age sex educ mstat using ZA5250_v2-0-0.dta, clear
// Poor health
recode hs01 (1 2 3 = 0 "Non-poor health") ///
( 4 5 = 1 "Poor health") ///
(-9 = .), gen(poorhealth)
label var poorhealth "Poor health"
// Female sex
recode sex (2 = 1 "Female") ///
(1 = 0 "Male"), gen(female)
label var female "Female sex"
// Age
recode age (18/24 = 0 "18-24 y.") ///
(25/34 = 1 "25-34 y.") ///
(35/44 = 2 "35-44 y.") ///
(45/54 = 3 "45-54 y.") ///
(55/64 = 4 "55-64 y.") ///
(65/74 = 5 "65-74 y.") ///
(75/84 = 6 "75-84 y.") ///
(85/97 = 7 "85-97 y.") ///
(-32 = . ), gen(agecat)
label var agecat "Age"
// Education
recode educ (1 2 = 0 "Hauptschule or less") ///
( 3 = 1 "Mittlere Reife") ///
(4 5 = 2 "(Fach)Hochschulreife or more") ///
(-41 -9 6 7 = .), gen(education)
label var education "Education"
// Marital status
recode mstat (1 6 = 2 "Married/cohabiting") ///
(2 3 4 9 = 1 "Divorced, widowed etc.") ///
(5 = 0 "Never married") ///
(-9 = .), gen(married)
label var married "Marital status"
// Model
eststo clear
// AME
logit poorhealth i.female i.agecat i.education i.married
margins, dydx(*) post
eststo
// LPM
eststo: regress poorhealth i.female i.agecat i.education i.married, robust
esttab using amelpm.tex, drop(_cons) mtitle("AME" "LPM") label b(2) se(2) nonumbers booktabs ///
title("Predictors of poor self-rated health, Germany 2016 \label{tab1}") ///
addnote("\emph{Source}: Allbus 2016, doi: 10.4232/1.12754" ///
"AME: Average marginal effects, LPM: Linear probability model") ///
refcat(0.female "\emph{Sex}" ///
0.agecat "\emph{Age}" ///
0.education "\emph{Education}" ///
0.married "\emph{Marital status}", nolabel) ///
alignment(D{.}{.}{-1}) width(0.9\hsize) replace