Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: number of missing from previous year


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: number of missing from previous year
Date   Tue, 15 Aug 2006 23:45:44 +0100

Now the closing verbal comment is wrong. This 
counts those who leave, return, ..., and then leave
again just once for each firm. 

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Nick Cox
> Sent: 15 August 2006 22:42
> To: [email protected]
> Subject: RE: st: number of missing from previous year
> 
> 
> My code was wrong. I had 
> 
> bysort firm personid (year): gen left = _n == _N 
> bysort firm year : replace left = 0 if year == year[_N] 
> by firm year: egen number_left = total(left) 
> tabdisp firm year, c(number_l.eft) 
> 
> but it should have been 
> 
> bysort firm personid (year): gen left = _n == _N 
> bysort firm (year) : replace left = 0 if year == year[_N] 
> by firm year: egen number_left = total(left) 
> tabdisp firm year, c(number_left) 
> 
> Sorry about that. 
> 
> As flagged earlier, this counts those who leave even 
> if they return later in the panel. 
> 
> Nick 
> [email protected] 
> 
> Wanli Zhao
>  
> > Nick & David,
> > Thank you so much for your help. I tried both solutions. I 
> > think I got what
> > I want from David's code. I just need to reshape the data. I 
> > really like
> > Nick's solution because the simpler, the better. But, I got 
> > the result of
> > all 0 from Nick's solution and I do not know what's wrong. 
> > I'd like to learn
> > more please. 
> 
> *
> *   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/
> 

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