I would like to do this within a loop so that a '1' is placed in the 2 years before n_power1. However, this isn't applicable to all leaders, because some leaders were in power before the analysis timeframe of 2000-2011. The dataset below is a subset of data that includes 2 political leaders.
I have tried several iterations that have not worked, most recently:
Code:
gen lag_birth=1 if n2_power1<n2_power1[_n-2]
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int n_year float(n_birth leader_id n2_power1 n2_power2) 2000 1 1 1981 2011 2001 1 1 1981 2011 2002 1 1 1981 2011 2003 1 1 1981 2011 2004 1 1 1981 2011 2005 1 1 1981 2011 2006 1 1 1981 2011 2007 1 1 1981 2011 2008 1 1 1981 2011 2009 1 1 1981 2011 2010 1 1 1981 2011 2011 1 1 1981 2011 2000 0 9 2009 2011 2001 0 9 2009 2011 2002 0 9 2009 2011 2003 0 9 2009 2011 2004 0 9 2009 2011 2005 0 9 2009 2011 2006 0 9 2009 2011 2007 0 9 2009 2011 2008 0 9 2009 2011 2009 1 9 2009 2011 end
0 Response to Generate Leads and Lags
Post a Comment