I want to merge two data files. In file 1, I have bilateral trade data for 30 years with the exporter, importer id along with the year and other variables. In file 2, I have the data on the characteristics of the trade agreements signed between two or more countries. Based on country IDs from file 1, I have made bilateral pairs (country A and B) based on agreement signatory members along with the year of agreement in the next column. Country A and B (Both A and B can either be an exporter or importer) along with the year of the trade agreement. Now I want to merge file 2 into file 1 in such a way that each agreement characteristic (4 variables) information is reflected in front of their respective bilateral country pair (Exporter, Importer, year) from the year of the agreement till last time of the agreement (e.g., 1995 - 2003) because a revised agreement may have been signed between countries and new characteristics values need to be reflected for the next period between these countries (e.g. 2004-2014). Second in file 1 exporter and importer country is defined but in file 2, both Country A and B can be an exporter or importer (both way) because agreement works both way so how to reflect this while moving each agreement characteristics variables to file 1. Doing this manually for more than 100000 observations is a very time-consuming job. Is there any simple solution for this in Stata. I have attached both file sample excel file 1 and file 2 for your review.
-
Login or Register
- Log in with
Comment