Dear,

I have a data organized such that each observation is assigned to country in an eventID by year:

EventID Country Year
88 220 1870
88 271 1870
88 255 1870
220 3251870
220 710 1870
220 2 1870
220 220 1870
2117 70 1870
2117 70 1870
2168 255 1871
2168 255 1871
2169 365 1871
2169 220 1871
256 230 1872
256 2 1872
256 200 1872

I need this reshaped to dyad/year data under EventID to merge the other data which is a dyadic trade data, so the following shape is what I want to reshape.

EventID Country Country2 Year
88 220 271 1870
88 220 255 1870
88 220 325 1870
88 271 220 1870
88 271 255 1870
88 271 325 1870
88 325 220 1870
88 325 271 1870
88 325 255 1870
.
.
.
256 2 200 1872
256 200 2 1872
.
.
.

I've tried to create a dyadic data by using egen country2 group('var' 'var1') to merge it with a dyadic trade data.
But, I think I need to reshape the data first before merging two data.

Would anyone help me to reshape this data?

Best Regards,
Woo