Hi all,

I have a dataset from CEPII (gravdata.dta) which I have cleaned up to contain only specific countries/years/variables.
The gravdata dataset looks as follows:
iso3_o iso3_d year distance gdp_o gdp_d etc... (many variables)
AGO BDI 1994
AGO BDI 1997
AGO GMB 2006
BDO SEN 1985
BDO SEN 2006

I'd like to merge this dataset with a dataset containing the bilateral trade between country pairs. I use data from the DOTS division of IMF.

data looks as follows:

Array



I'm not sure if I have to use merge (and which one?) or joinby given that I need the country pairs to align as well as the years.
Also, In one dataset I have data for all years running from 1985 to 2015 at 3-year intervals while the other dataset only has some of the values for corresponding years.

Thanks for your help!