Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Keep longest consecutive streak in panels


From   Daniel Lawson <[email protected]>
To   [email protected]
Subject   Re: st: Keep longest consecutive streak in panels
Date   Thu, 13 Jan 2005 15:06:52 -0500

On Jan 13, 2005, at 2:56 PM, LACHENMAIER wrote:
I have an unbalanced panel data set of firms. For some firms there are
data completely missing for some years. So there are gaps existing at
the beginning, at the end and also somewhere in the middle of the time
frame.
What I want to do now, is to keep only those observations for each firm
which are part of the longest consecutive streak of existing entries.

This was discussed last fall on this list, and a question that arose then applies to your question also: what would you want done in the case where a firm has two streaks of equal length?

Example:
Obs Firm year
1 1 1981
2 1 1980
3 1 1985
4 1 1986

Daniel Lawson

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index