Statalist The Stata Listserver


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

RE: st: Counting Ulcers


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Counting Ulcers
Date   Thu, 7 Sep 2006 22:52:19 +0100

-egen, total()- (formerly -sum()-) just ignores 
missings. 

The problem with -collapse- is that you have no 
way of relating the results to the original dataset. 
It solves the problem as posed, but at a price. 

Nick 
n.j.cox@durham.ac.uk 

Dimitriy V. Masterov
 
> Try
> 
> bys id: egen type=sum(vi) if vi~=.
> collapse type, by(id)
> 
> This will count people with missing observations as "." and not zero,
> and it will avoid double-counting.

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