Hi all,
I am new on Stata so my knowledge is limited. I have a variable that indicates whether the respondents' children are natural, adopted, foster etc. or not. This variable is repeated 20 times (asked to respondents depending on their children number). I would like to gather this information and create a new variable that indicates if the child is natural or not. I tried to create loop or tried to use egen command but I was unsuccessful...
that's why i write:
gen natural_child=.
replace natural_child=1 if rel_chil_1=1|6|7|8
replace natural_child=1 if rel_chil_2=1|6|7|8
replace natural_child=1 if rel_chil_3=1|6|7|8
.
.
.
Can you help me and show me how to create a new variable more efficient way?
Thanks in advance.
Kind regrads,
Martin.
Related Posts with loop question
marginsI have the following dataset. The dataset is about loans and it's interest rates, there are more var…
Logistic Regression IssuesI am trying to perform a logistic regression but I am running into issues with the var. I keep getti…
Advanced Stata programming question: Dialog box for user-defined powerHi everyone, I am looking to create a dialog box (or add to the power dialog box?) for a user-defin…
No support for meqrlogit as of Stata 16I looked at the help file for meqrlogit in Stata 16 and it is no longer part of Stata 16. I couldn't…
Variable Name Error (r198) in asregHi, I am trying to estimate the impact of directors' remuneration on firm performance. My unbalance…
Subscribe to:
Post Comments (Atom)
0 Response to loop question
Post a Comment