Hi everyone,
I would like to create a dummy variable that equals 1 for one year after the CEO changes and one year before the CEO changes by using loop functions such as forvalues, but I do not have any ideas how to create that variable. I used execid (executives’ ID) and ceoann (CEO annual flag) to identify whether firms have CEO changes across years. Therefore, I created a variable: CEO_changes that equals 1 for firms having CEO changes and 0 otherwise. In particular:
gen lag_execid = l1.execid
gen CEO_changes = 1 if ceoann == “CEO” & execid != lag_execid
replace CEO_changes = 0 if ceoann == “CEO” & execid == lag_execid
However, I do not know how to create a dummy that equals one year before and 0 for one year after the CEO changes in next steps. Can you suggest me some ideas? Thank you.
I would like to create a dummy variable that equals 1 for one year after the CEO changes and one year before the CEO changes by using loop functions such as forvalues, but I do not have any ideas how to create that variable. I used execid (executives’ ID) and ceoann (CEO annual flag) to identify whether firms have CEO changes across years. Therefore, I created a variable: CEO_changes that equals 1 for firms having CEO changes and 0 otherwise. In particular:
gen lag_execid = l1.execid
gen CEO_changes = 1 if ceoann == “CEO” & execid != lag_execid
replace CEO_changes = 0 if ceoann == “CEO” & execid == lag_execid
However, I do not know how to create a dummy that equals one year before and 0 for one year after the CEO changes in next steps. Can you suggest me some ideas? Thank you.
gvkey | fyear | ceoann | execid | execid_n | lag_execide | CEO_changes |
1004 | 2002 | 9252 | 9252 | |||
1004 | 2003 | 9251 | 9251 | 9252 | ||
1004 | 2004 | 9252 | 9252 | 9251 | ||
1004 | 2005 | 23781 | 23781 | 9252 | ||
1004 | 2006 | CEO | 9249 | 9249 | 23781 | 1 |
1004 | 2007 | CEO | 9249 | 9249 | 9249 | 0 |
1004 | 2008 | 23781 | 23781 | 9249 | ||
1004 | 2009 | 36199 | 36199 | 23781 | ||
1004 | 2010 | CEO | 9249 | 9249 | 36199 | 1 |
1004 | 2011 | 41787 | 41787 | 9249 | ||
1004 | 2012 | 33979 | 33979 | 41787 | ||
1004 | 2013 | 46404 | 46404 | 33979 | ||
1004 | 2014 | 46404 | 46404 | 46404 | ||
1004 | 2015 | CEO | 9249 | 9249 | 46404 | 1 |
1004 | 2016 | 51706 | 51706 | 9249 | ||
1034 | 2002 | |||||
1034 | 2003 | |||||
1034 | 2004 | |||||
1034 | 2005 | |||||
1034 | 2006 | |||||
1038 | 2002 | |||||
1045 | 2001 | 3662 | 3662 | |||
1045 | 2002 | CEO | 3661 | 3661 | 3662 | 1 |
1045 | 2003 | 3661 | 3661 | 3661 | ||
1045 | 2004 | 16654 | 16654 | 3661 | ||
1045 | 2005 | 16654 | 16654 | 16654 | ||
1045 | 2006 | 16654 | 16654 | 16654 | ||
1045 | 2007 | 28280 | 28280 | 16654 | ||
1045 | 2008 | CEO | 14591 | 14591 | 28280 | 1 |
1045 | 2009 | 28280 | 28280 | 14591 | ||
1045 | 2010 | 28280 | 28280 | 28280 | ||
1045 | 2011 | CEO | 14591 | 14591 | 28280 | 1 |
1045 | 2014 | 46189 | 46189 | |||
1045 | 2015 | 46190 | 46190 | 46189 | ||
1045 | 2016 | 46193 | 46193 | 46190 |
Comment