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
Mean Centering Variable for InteractioneffectDear Statalists I'm in the final phase of my research and I want to look into the interaction effec…
Help interpreting within a factor variableHi, I'm trying to calculate the probability of a movie having a sequel (hassequel) and am strugglin…
heteroscedasticity test white vs BPHello, I was checking my model for heteroscedasticity, and weird enough, I found a different outcom…
Cumulative incidence estimation in the presence of competing risksGood evening, In the last two days I'm dealing with "Cumulative incidence estimation in the presenc…
Regression by yearHi all, I have a dataset that includes a list of information on companies from 2000-2014. I am loo…
Subscribe to:
Post Comments (Atom)
0 Response to Generating variables in migration panels
Post a Comment