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

st: RE: -count- continuous data in panels


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: -count- continuous data in panels
Date   Mon, 16 Feb 2004 17:56:52 -0000

Please see the FAQ 
http://www.stata.com/support/faqs/data/panel.html

Nick 
[email protected] 

[email protected]
> 
> I have a balanced panel dataset; for example 1000 cross 
> sections, from 1990-1999
> for each cross sections. Now, if I wish to count the 
> observations in each panel
> that are not missing values, this can be done via -by ... : 
> egen count [if
> expression]-
> 
> However, in my case I wish to count the maximum number of 
> continuous yearly
> observations that are not missing values for a specified variable.
> 
> To make myself more clear, for example, if the variable X1 
> has for the AA cross
> section values only for 1991-1992, 1995 and 1996-1999, then 
> the maximum number
> of continuous observations is 4 (1996-1999).
> 
> Another example, if the variable X1 has for the BB cross 
> section values only
> from 1993-1998, then the maximum number of continuous 
> observations is 6. 

*
*   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