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
Drop countriesDear All, in my panel dataset, there are 3 countries that whenever i drop them, the model won't run.…
Do-file stops processing commands following ODBC SQL SELECT loadingUsing Stata 15.1/IC on Win 10 Pro, 16GB RAM, Intel i7-8550U CPU @ 1.80GHz 4 core processor Hi Stat…
Panel Var IRFDear All, I'm running panel var on two datasets and i want to compare their irf graphs. i want to pu…
Having multiple varlists using syntax commandHello all, I was wondering how I can have multiple varlists using syntax command. As an example for …
Power of PVAR modelDear All, since there is no Rsquared in PVAR models. how can i test for the power of the model? …
Subscribe to:
Post Comments (Atom)
0 Response to Generating a New Variable based on Conditional IF Statements
Post a Comment