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

st: -count- continuous data in panels


From   [email protected]
To   [email protected]
Subject   st: -count- continuous data in panels
Date   Mon, 16 Feb 2004 17:34:14 +0000

Dear Statalisters,

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. 

Any advice is very welcome, many thanks in advance
Dimitris

--
This mail sent through http://webmail.bangor.ac.uk
*
*   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