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

Re: st: a question about panel data


From   "Dev Vencappa" <[email protected]>
To   <[email protected]>
Subject   Re: st: a question about panel data
Date   Thu, 28 Jul 2005 19:57:22 +0100

>
Until somebody else suggests a shorter way, one way to do it is the following:

gen count=.
levels id, local (levels)
foreach l of local levels{
count if id==`l'
replace count=r(N) if id==`l'
}
duplicates drop id count, force
tab count

I think that should work

Dev

>>> [email protected] 07/28/05 7:43 pm >>>
Dear Stata Users:

I have a panel data with i is id (person) and t is
year. Suppose I have only three years. Since I have a
unbalanced panel, I want to find how many persons (i)
have only 1 year's data, and how many have only 2
years' data, and how many have 3 years data. 

Is there a convenient way to do this in Stata? Thanks
for your help in advance.

Shuaizhang


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 
*
*   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/


This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.


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