I am trying to create a routine that will define year dummies for the time a person is a political leader.
Using our current President as an example, Obama assumed office in 2009 and is still our current political leader (2009-2016). I want to create the following:
y2007 y2008 y2009 y2010 y2011...y2016 power1 power2
I have the dates correctly formatted as well as the leader structure and am currently using replace with if statements. However, that doesn't seem efficient.
I think it is more efficient to do this as a macro, but I'm not sure how to correctly define the time between (ie.2009-2016).
Thanks in advance for any solutions.
Using our current President as an example, Obama assumed office in 2009 and is still our current political leader (2009-2016). I want to create the following:
y2007 y2008 y2009 y2010 y2011...y2016 power1 power2
Leader | y2007 | y2008 | y2009 | y2010 | ... | y2016 | power1 | power2 |
Obama | 0 | 0 | 1 | 1 | 1 | 1 | 2009 | 2016 |
I think it is more efficient to do this as a macro, but I'm not sure how to correctly define the time between (ie.2009-2016).
Thanks in advance for any solutions.
Comment