Hello STATA Experts: I am trying to create a new variable based on the existence of certain conditions in two existing variables (see code below). It appears to be dropping most of the cases for "Fathers". Not sure what is wrong here. Also, how is this treating missing variables?
Any help would be appreciated. Pat
generate parentfigure=.
replace parentfigure=0 if X1HPAR1==2 | X1HPAR2==2
replace parentfigure=1 if X1HPAR1==1
label define parentfigurelab 0 "Father" 1 "Mother"
label values parentfigure parentfigurelab
label variable parentfigure "Parent Figure"
Related Posts with Generating a New Variable based on Conditional IF Statements
Using lagged instrumental variable for lagged endogeneous variableDear Statalist members, I am trying to use IV model with panel data (xtivreg) along with fixed effe…
Using lagged instrumental variables for lagged endogenous variablesDear Statalist members, I am trying to use IV model with panel data (xtivreg) along with fixed effe…
Wrong efficient signs on regressionHi everyone, I am carrying out a study on the effect of unemployment on happiness(individual satis…
Stata and Mata give different results for OLSI am confused why Stata OLS and Mata would give me different results, rather one of them is incorrec…
KHB method for mediation analysisDear all, I came across the KHB method for mediation analysis. I have gone through the paper “Compar…
Subscribe to:
Post Comments (Atom)
0 Response to Generating a New Variable based on Conditional IF Statements
Post a Comment