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
Fixed Effect Regression - Firm Level and Industry Level effectsHello, I am working with panel data for US-listed manufacturing firms for the period 2000-2019. I h…
Trade signals time series dataHi! I have a question regarding the following; I have obtained buy signals from stock data for every…
ploting the panel data by using "LPM" methodhello everyone, I use the "local projection method " for estimating the effect of the crisis on fert…
Reading xml filesDear all, It's the first time that I'm trying to work with xml files. Unfortunately, in this post I…
Generating new dummy var in an individual level dataset that gives country-year level information for each individualHello, I have individual-level data that looks like this: indiv_id country_code indiv_disc_dummy…
Subscribe to:
Post Comments (Atom)
0 Response to loop question
Post a Comment