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
Adding post-estimation results in -esttab- table by adding more columns to e(b) and columns and rows to e(V)Dear Statalist, I want to put -nlcom- results in esttab table and these -nlcom- results are treated…
Can I use multiple imputed data in a principle component analysis if my data are not normally distributed?Is it possible to use multiple imputed data in a principle component analysis if my data are not nor…
Forest plot of sub-groups and testing for interactionDear Statlist, I'm trying to generate a forest plot to demonstrate how various parameters from my r…
Should I use a heckman selection model when extracting a subset of my data for analysis?This is a new topic for me, so pardon my basic understanding of the heckman model. In fact, it's pos…
Drop (Keep) observationsDear experts, I'm wondering how to drop (or keep) my observations. Below is my dataset. What I want…
Subscribe to:
Post Comments (Atom)
0 Response to Generating variables in migration panels
Post a Comment