Hi all,
I hve this data set
I would like to generate a new variable called TB under the following condition: when cntry_yr_a = cntry_yr_b (they are not horozontally equal, stata will have to search for the correspondign row), i want the difference between countrya_exp and countryb_imp
basically the trade balance
I tried bysort country_year_a cuontry_year_b: egen TB=countrya_exp - countryb_imp,
i am getting an error
can someone help me on that
I hve this data set
ctry_year_a | ctry_year_b | trade | countrya_Exp | countryb_imp |
21882 | 401882 | 3.80E+08 | 6.31E+09 | 4.58E+08 |
21883 | 401883 | 4.07E+08 | 7.16E+09 | 4.88E+08 |
21884 | 401884 | 3.52E+08 | 6.58E+09 | 4.28E+08 |
21885 | 401885 | 2.78E+08 | 6.51E+09 | 3.87E+08 |
21886 | 401886 | 3.42E+08 | 6.93E+09 | 4.55E+08 |
21887 | 401887 | 3.19E+08 | 7.08E+09 | 4.21E+08 |
21888 | 401888 | 3.11E+08 | 6.93E+09 | 4.14E+08 |
21889 | 401889 | 3.35E+08 | 7.67E+09 | 4.49E+08 |
21890 | 401890 | 3.64E+08 | 8.64E+09 | 4.93E+08 |
21891 | 401891 | 4.01E+08 | 8.92E+09 | 5.44E+08 |
21892 | 401892 | 5.45E+08 | 1.01E+10 | 7.27E+08 |
21893 | 401893 | 5.89E+08 | 9.12E+09 | 7.31E+08 |
21894 | 401894 | 6.12E+08 | 9.33E+09 | 7.68E+08 |
21895 | 401895 | 4.10E+08 | 9.40E+09 | 5.85E+08 |
basically the trade balance
I tried bysort country_year_a cuontry_year_b: egen TB=countrya_exp - countryb_imp,
i am getting an error
can someone help me on that
Comment