Hi All,
This is my first post, so excuse me breaking any rules/conventions.
I'm trying to generate a set of variables from German migration data.
I am using a panel data set of East Germans (obs. from 1990-2016) where I have a dummy variable (varname = east) for the region the person currently lives in, taking values 1 (East Germany) and 0 (West Germany).
1.) I successfully created an emigrate dummy, which =1 if the individual migrated to West Germany in the last year.
2.) I successfully created a remigrate dummy, which =1 if the individual returned to East Germany in the last year.
3.) I want to create a returner dummy, which =1 if the individual has returned in the past. I failed to do so, this is my code:
gen return = 0
replace return = 1 if east==1 & (l.east==0| l2.east==0| l3.east==0| l4.east==0|l5.east==0| l6.east==0| l7.east==0| l8.east==0| l9.east==0| l10.east==0|l11.east==0| l12.east==0 | l13.east==0| l14.east==0| l15.east==0| l16.east==0|l17.east==0| l18.east==0| l19.east==0| l20.east==0| l21.east==0| l22.east==0|l23.east==0| l24.east==0| l25.east==0 | l26.east==0 | l27.east==0)
---- Logic: Two ifs, 1.) lives in East-Germany 2.) has lived in west-germany in the past, using lags
This doesn't work however, it seems to pick up people that never lived in West Germany
4.) I want to create a returner-to-be variable, which=1 if the individual will return in the future, but has not done so yet (still lives in East or West)
gen returnfuture = 0
replace returnfuture = 1 if (return==0 & (f.remigrate==1 | f2.remigrate==1 | f3.remigrate==1 | f4.remigrate==1 | f5.remigrate==1 | f6.remigrate==1 | f7.remigrate==1 | f8.remigrate==1 f9.remigrate==1 | f10.remigrate==1 | f11.remigrate==1 | f12.remigrate==1 | f13.remigrate==1 | f14.remigrate==1 | f15.remigrate==1 | f16.remigrate==1 | f17.remigrate==1 | f18.remigrate==1 | f19.remigrate==1 | f20.remigrate==1 | f21.remigrate==1 | f22.remigrate==1 | f23.remigrate==1 | f24.remigrate==1 | f25.remigrate==1 | f26.remigrate==1 | f27.remigrate==1 ))
----Same logic, but I need the return variable first, and I'm not sure if this is itself correct.
I would very much appreciate your help on point 3.) and 4.), thank you.
Guus
Related Posts with Generating variables in migration panels
Real Stepwise RegressionsI found only a one-step procedure that leaves in the model only variables with a certain p-value. I…
Destring selected variables ending with a number suffixHello everyone, I have a rather simple question and was wondering if someone can help me with it. …
use dataI know it is a question that must be easy for you to answer but this is my first ever assignment wit…
Chow test of Structural BreakDear Statalist members, Can Chow test be performed on panel data with only one variable? I would li…
Steady state for ARIMA modelsHi, I need to test the hypothesis that fixed effects in my model do not correlate with deviations f…
Subscribe to:
Post Comments (Atom)
0 Response to Generating variables in migration panels
Post a Comment