Dear statalists,
I have data on bilateral trade between the reporter and partner. In particular, I have the exports from the reporter to the partner for the years 2000-2005. I have uploaded a snapshot that illustrates what my data looks like. I want to find the total trade flows between each pair of country. In other words, I want to sum the exports from one pair (e.g albania argentina) plus the exports from the inversed pair (argentina albania). I know that for a specific year we can use :
. generate first = cond(reporter < partner, reporter, partner) . generate second = cond(reporter < partner, partner, reporter)
. egen total = total(trade), by(first second) However, now I have many years and I do not know how to do this.
Regards,
Andrew
I have data on bilateral trade between the reporter and partner. In particular, I have the exports from the reporter to the partner for the years 2000-2005. I have uploaded a snapshot that illustrates what my data looks like. I want to find the total trade flows between each pair of country. In other words, I want to sum the exports from one pair (e.g albania argentina) plus the exports from the inversed pair (argentina albania). I know that for a specific year we can use :
. generate first = cond(reporter < partner, reporter, partner) . generate second = cond(reporter < partner, partner, reporter)
. egen total = total(trade), by(first second) However, now I have many years and I do not know how to do this.
Regards,
Andrew
Comment