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