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" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
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 
n.j.cox@durham.ac.uk 

absc11@bangor.ac.uk
> 
> 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index