Hi,

I want to generate dummy2=1 if dummy1 is continuous (equal 1) for the 3 next years period.

Any ideas?

firm_id year dummy1 dummy2
1 2000 0 1
1 2001 1 1
1 2002 1 0
1 2003 1 0
1 2004 1 0
1 2005 0 0
2 2010 0 1
2 2011 1 1
2 2012 1 0
2 2013 1 0
2 2014 1 0
2 2015 0 0
3 2003 0 0
3 2004 1 0
3 2005 0 0
3 2006 1 0
3 2007 0 0