Hey everyone!
I have a question regarding dummy variables.
I have some panel data over a time period from 1997-2014 on trade between different countries and sectors and would like to find out how many new regional trade agreements (variable: rta) were formed during that time. The variable is 0 if none exists and 1 if a trade agreement is in place.
I have created a variable called ‘countrypair’ for each unique country combination there exists, which numbers all existing country pairs from 1 to 10,817.
Ideally, I now would like to have a new dummy variable (e.g. new_rta), which is equal to 1 if a new trade agreement has been formed, i.e. when the dummy variable rta has switched from 0 to 1 for the very first time for this country pair. Otherwise new_rta should be equal to 0.
Does anyone have a clue which commands could be used to detect such a change in the dummy variable conditional on the countrypair?
Thanks a lot in advance for any help!!
I have a question regarding dummy variables.
I have some panel data over a time period from 1997-2014 on trade between different countries and sectors and would like to find out how many new regional trade agreements (variable: rta) were formed during that time. The variable is 0 if none exists and 1 if a trade agreement is in place.
I have created a variable called ‘countrypair’ for each unique country combination there exists, which numbers all existing country pairs from 1 to 10,817.
Ideally, I now would like to have a new dummy variable (e.g. new_rta), which is equal to 1 if a new trade agreement has been formed, i.e. when the dummy variable rta has switched from 0 to 1 for the very first time for this country pair. Otherwise new_rta should be equal to 0.
Does anyone have a clue which commands could be used to detect such a change in the dummy variable conditional on the countrypair?
Thanks a lot in advance for any help!!
Comment