Dear Stata experts,
I currently work with the CEPII gravity model dataset which can be downloaded here: http://www.cepii.fr/CEPII/en/bdd_mod..._item.asp?id=8. The dataset consists of 4.4 mio observations of tradeflows for 257 countries between 1948 and 2019.
I am trying to add a new variable which gives the sum of imports from and exports to China for each country. The following command specifically gives the exports to China:
"gen expo_china= tradeflow_baci if iso3num_d == 156"
Similarly: "gen impo_from_china= tradeflow_baci if iso3num_o == 156" generates an extra column witht all Chinese exports. The problem is that I can't create a sum of them because the exports to China appear at the end of the row of each country the tradeflow has originated from while the data for the imports from China appear at the end of the row of China as the originating country (since from the Chinese perspective they are exports).
Is there any way these two informations can be matched and then summed up?
Kind regards
Michael
I currently work with the CEPII gravity model dataset which can be downloaded here: http://www.cepii.fr/CEPII/en/bdd_mod..._item.asp?id=8. The dataset consists of 4.4 mio observations of tradeflows for 257 countries between 1948 and 2019.
I am trying to add a new variable which gives the sum of imports from and exports to China for each country. The following command specifically gives the exports to China:
"gen expo_china= tradeflow_baci if iso3num_d == 156"
Similarly: "gen impo_from_china= tradeflow_baci if iso3num_o == 156" generates an extra column witht all Chinese exports. The problem is that I can't create a sum of them because the exports to China appear at the end of the row of each country the tradeflow has originated from while the data for the imports from China appear at the end of the row of China as the originating country (since from the Chinese perspective they are exports).
Is there any way these two informations can be matched and then summed up?
Kind regards
Michael
Comment