Hi everyone 
I'm facing a problem on stata, I really don't know how to solve this. So basically i have bilateral data per 10 years (stock of migrants) and I would like to get the difference of migrants in a country to be used as a proxy for bilateral flows (i know it is a big assumption, but it quite fits my work). My data look like this:
I would like to obtain the MigrantsFlows column. I tried to use the following commands:
xtset year countryO countryD
gen MigrantsFlows = D.MigrantsStock
but too many variables are specified in my xtset. Does someone have any idea about how to do this?
Thank you in advance
Killian

I'm facing a problem on stata, I really don't know how to solve this. So basically i have bilateral data per 10 years (stock of migrants) and I would like to get the difference of migrants in a country to be used as a proxy for bilateral flows (i know it is a big assumption, but it quite fits my work). My data look like this:
Year | CountryO | CountryD | MigrantsStock | MigrantsFlows |
1970 | Afghanistan | x | 100 | |
1970 | Afghanistan | y | 50 | |
1980 | Afghanistan | x | 75 | -25 |
1980 | Afghanistan | y | 60 | +10 |
xtset year countryO countryD
gen MigrantsFlows = D.MigrantsStock
but too many variables are specified in my xtset. Does someone have any idea about how to do this?
Thank you in advance

Killian
Comment