Statalist


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

RE: st: SUM question


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: SUM question
Date   Thu, 15 May 2008 14:57:42 +0100

-viewsource _growtotal.ado- shows that treating missings as 0 is exactly
what -egen, rowtotal()- does. 

Nick 
[email protected] 

David Bell

You have surmised that -egen newvar = rowtotal(var1 var2)- treats  
missing values as zero.  I do not believe this is strictly correct.   
The command just sums the values that it has (thus not using a  
variable in a sum is the same as treating it as zero).  This is why I  
always use -rowmean- instead of -rowtotal-.  Thus when there is a  
missing value, you get the mean of the remaining values (they are not  
treated as zeros).

On May 15, 2008, at 12:31 AM, Yamamoto, Satomi wrote:

> I think  egen newvar = rowtotal(var1 var2) is equivalent to  
> replacing missing values with 0(zero).

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