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

From |
Michael Mitchell <Michael.Norman.Mitchell@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Collapse with sum function and missing values |

Date |
Wed, 10 Feb 2010 14:13:09 -0800 |

Thanks all, both for the general thoughts on the underlying rationale for this, as well as the practical suggestions. As some noted, I could do this... . collapse (sum) x (count) nonmiss=x, by(group) . replace x=. if nonmiss==0 I have about 100 "x" values, and there is no pattern to the names. All methods I can think of for ensuring that the "x" values are . when all members of the group are . involve either substantial typing or a fair amount of programming. Am I overlooking a simple solution for this? Thanks, Michael On Wed, Feb 10, 2010 at 7:14 AM, Martin Weiss <martin.weiss1@gmx.de> wrote: > > <> > > > > As in http://www.stata.com/statalist/archive/2010-02/msg00428.html ? > > > > HTH > Martin > > > -----Ursprüngliche Nachricht----- > Von: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Elizabeth > Allred > Gesendet: Mittwoch, 10. Februar 2010 16:12 > An: statalist@hsphsun2.harvard.edu > Betreff: Re: st: Collapse with sum function and missing values > > 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/ > > > * > * 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/

**Follow-Ups**:**Re: st: Collapse with sum function and missing values***From:*Scott Merryman <scott.merryman@gmail.com>

**RE: st: Collapse with sum function and missing values***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**Re: st: Collapse with sum function and missing values***From:*Kit Baum <baum@bc.edu>

**Re: st: Collapse with sum function and missing values***From:*"Elizabeth Allred" <lizard@hsph.harvard.edu>

- Prev by Date:
**Re: st: about the temporal desagragation** - Next by Date:
**RE: st: Collapse with sum function and missing values** - Previous by thread:
**AW: st: Collapse with sum function and missing values** - Next by thread:
**RE: st: Collapse with sum function and missing values** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |