Hi all, I have "gravity" data set where i have tariffs and trade year. There are instances when, for example, the years for tariff data for a commodity number 4311 (SITC rev.3) is 2007,2004 and 2006, but trade is taking place only in 2008. So, TRAINS database is using 2008 as the closest trade data for these 3 years. The thing is the trade takes place in 2008, but there is no tariff set for 4311 for that year, instead there are 3 other (2007,2006 and 2004).
So, what i want to do is to keep my duplicate panelids that have the smallest absolute value of "tradeyear-tariffyear" or var dif as i put it in the dataset. In other words, I want to keep the smallest diff given a (duplicate) panelid.
I attached the screenshot of an example duplicate panelid. (i.e. i want to keep observation # 4, since dif is smallest given its panelid, etc.)
Appreciate it.
So, what i want to do is to keep my duplicate panelids that have the smallest absolute value of "tradeyear-tariffyear" or var dif as i put it in the dataset. In other words, I want to keep the smallest diff given a (duplicate) panelid.
I attached the screenshot of an example duplicate panelid. (i.e. i want to keep observation # 4, since dif is smallest given its panelid, etc.)
Appreciate it.
Comment