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
Asset/wealth index with PCABackground: We are studying a rural population of 375 malawian households, and are trying to make an…
How to interpret regression results if dependent variable is logged and independent variables are standardized?Array In my fixed effects panel regression analysis the DV (Triadic Patent Families) enters in logar…
Gini index interpretation - time use dataHi everyone, I am using Italian Time Use surveys to analyze parental time investments. I used ineqde…
Hiding bar of one category in -tabplot-Dear users, I am using -tabplot- to realize the following graph (see attachment) and I would like to…
Percentiles and data trimmingGood morning I tried to find an answer to my (apparently) easy question on the forum, but probably i…
Subscribe to:
Post Comments (Atom)
0 Response to loop question
Post a Comment