Good afternoon,
I'm quite new here and would like to know if somebody could help me with this. (I tried to find the answer prior to post but my lack of experience perhaps prevailed)
I'm working with panel data, around 19 countries, and 20 years. I have a variable X, I need to create a dummy per country and year where the country had a value out of an interval of 3 to -3. In other words:
X>3 or <-3 In 2001 for Argentina, then I would need a dummy ARG2001=1 only for Argentina in year 2001. And go on... I'm creating variables following these steps:
1) I identified countries and years with X>3 or X<-3...
2) With these commands I'm creating the dummies:
generate ARG2001=0
replace ARG2001=1 if countrycode=="ARG" & year==2001
It is working but it is too laborious because I have approximately 9 different countries that repeat in some years then... Until now I have created around 30 dummies and have just finished 2 out of the 9 countries. The other countries have not many observations out of the interval but I think I could optimize my time if there were a way to do this more quickly...
Thank you for your feedback and suggestions.
I'm quite new here and would like to know if somebody could help me with this. (I tried to find the answer prior to post but my lack of experience perhaps prevailed)
I'm working with panel data, around 19 countries, and 20 years. I have a variable X, I need to create a dummy per country and year where the country had a value out of an interval of 3 to -3. In other words:
X>3 or <-3 In 2001 for Argentina, then I would need a dummy ARG2001=1 only for Argentina in year 2001. And go on... I'm creating variables following these steps:
1) I identified countries and years with X>3 or X<-3...
2) With these commands I'm creating the dummies:
generate ARG2001=0
replace ARG2001=1 if countrycode=="ARG" & year==2001
It is working but it is too laborious because I have approximately 9 different countries that repeat in some years then... Until now I have created around 30 dummies and have just finished 2 out of the 9 countries. The other countries have not many observations out of the interval but I think I could optimize my time if there were a way to do this more quickly...
Thank you for your feedback and suggestions.
Comment