Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Collapse with sum function and missing values


From   "Elizabeth Allred" <lizard@hsph.harvard.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Collapse with sum function and missing values
Date   Wed, 10 Feb 2010 10:12:22 -0500

Michael might use collapse (count) and then set his sum to missing when count=0.

>>> On 2/10/2010 at 10:06 AM, in message
<1F1A9AC9-4E03-488D-ADA4-971B6A192CEE@bc.edu>, Kit Baum <baum@bc.edu> wrote:
<> >
> This is somewhat semantic. The presence of 3 and 4 in the group id suggests 
> that such groups exist; they merely have no members in the present sample. It 
> should be easy enough to -mvdecode- x==0 to x==.
> 
> This reminds me of a grouse I had about the calculation of the s.d. of data 
> that were all missing. The mean of these data was computed properly as 
> missing, but the s.d. was reported as 0. Pedantically, as all values took on 
> the same NAN value, there was indeed zero variance. I convinced StataCorp 
> that this was not a good idea, and that the s.d. or variance of data that are 
> all missing is indeed missing. That is now what -tabstat- does.
> 
> Kit
>  
> On Feb 10, 2010, at 2:33 AM, Michael wrote:
> 
>>  Shouldn't the value of -x- for groups 3 and 4 be missing, not zero.
>> To me, the sum of a series of missing values is a missing value. I am
>> doing a collapse for about 100 variables (100 x values) and need the
>> value to be defined as missing (not 0) in such cases. Any ideas?
> 
> 
> Kit Baum   |   Boston College Economics & DIW Berlin   |   
> http://ideas.repec.org/e/pba1.html 
>                               An Introduction to Stata Programming  |   
> http://www.stata-press.com/books/isp.html 
>    An Introduction to Modern Econometrics Using Stata  |   
> http://www.stata-press.com/books/imeus.html 
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search 
> *   http://www.stata.com/support/statalist/faq 
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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