Real data may be very complex. The following is a fake example and the solution of my best guess of what you want .
clear
input company year x
1 2007 78
1 2008 89
1 2010 142
1 2011 211
2 2007 88
2 2008 451
2 2009 156
2 2011 254
2 2012 122
3 2010 111
3 2011 58
3 2012 54
3 2013 325
4 2007 99
4 2008 109
end
tsset company year
ssc install tsspell, replace //onetime install the user-written command tsspell
tsspell, f(L.year == .)
by company: egen maxrun = max(_seq)
keep if maxrun>=3 //my best guess of what you want


雷达卡





京公网安备 11010802022788号







