Dear Statalist community,
I'm working on bilateral trade openness between countries, and I am searching for a way to sum observations from country a to b with b to a. Here is an example of the dataset I am dealing with:
Code:
iso3_o    iso3_d    year    import_openness
DEU    FRA    1978    .0306583
DEU    FRA    1979    .0312403
FRA    DEU    1978    .0185003
FRA    DEU    1979    .020072
Here,I would like to sum the import openness from Germany to France and from France to Germany for each year. I was wondering if there was a way to compute this for a large dataset (400k+ observations). I've succeeded using the command -reshape- accordingly, but it does not work for the complete dataset as there is too many values.
The goal is to generate a new variable that looks like this: Array

With each element being the import openness between country i and j at time t (import flow divided by the importer GDP).

Thank you in advance !