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
help exporting lstat results after logistic regression into word/excel documentshi all, does anyone know of a way to export the results of lstat into a word document or a table/exc…
Creating variables for husband and wife using data for respondent and their partnerDear Statalist. I would like help to generate a variable, say level of education "educ" for the mal…
Creating a variable equal to 1 if a name (i.e., string) at time t-4 appears at time tI have Brazilian electoral data with the names of candidates who ran for mayor from 2000 to 2016. Th…
Choose Which Fixed Effect Has Coefficient 0Hi Statalisters, I'm running a fixed-effects regression with fixed-effects by region (e.g. Americas…
Threshold for small/large T in quarterly panel dataDear all, Sorry for basic question. I am estimating dynamic panel data model for 40 countries &…
Subscribe to:
Post Comments (Atom)
0 Response to Generating variables in migration panels
Post a Comment