Statalist The Stata Listserver


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

RE: st: Counting Ulcers


From   "Nick Cox" <[email protected]>
To   <[email protected]>
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 
[email protected] 

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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index