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

From |
"Martin Weiss" <Martin.Weiss1@gmx.de> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Perplexed by the SUM function |

Date |
Mon, 16 Mar 2009 23:36:22 +0100 |

<> You say you want to treat the missings as zero, so you are pretending that someone who refused to answer should be treated as someone who did and falls into category zero. That is your prerogative. But if you do change your mind, you may want to look at -egen, rownonmiss- to form your average. All this in addition to Eva`s advice, of course. BTW, no need to apologize for basic questions :-) HTH Martin -------- Original-Nachricht -------- > Datum: Mon, 16 Mar 2009 15:05:02 -0700 (PDT) > Von: Lena Cuisina <lenazoid@yahoo.com> > An: statalist@hsphsun2.harvard.edu > Betreff: st: Perplexed by the SUM function > > I have a very basic question. I’m adding up responses to 5 questions. > Some of the questions have missing data. This is what I don’t want to > do, because I don't want to lose the 23 observations: > > . gen gh_raw = gh1 + gh2 + gh3 + gh4 + gh5 > (23 missing values generated) > > . gen gh_avg = gh_raw/5 > (23 missing values generated) > > I want to use whatever data I’ve got from the other questions in > calculating the sum -- ie, I’d like to great the missing as zero, not missing. > So I tried the sum function: > > gen gh_raw1 = sum(gh1+gh2+gh3+gh4+gh5) > > gen gh_avg1 = gh_raw1/5 > > All 5 questions have the same 5-category ordinal response scale that’s > coded 0, 25, 50, 75, 100. So the average of the 5 responses are within the > 0 to 100 range. Unfortunately, the command I've written with the sum > function gives me a set of average scores with a maximum of 18,800. It’s > crazy. > > I have no idea what I’m doing wrong, because I’m pretty new to Stata. > Sorry for such a basic question. > > Lena > > > > > > * > * 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/ -- Martin Weiss Hackersteigle 3 72076 Tübingen 00497071/793535 00491784597218 Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 * * 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/

**References**:**st: Perplexed by the SUM function***From:*Lena Cuisina <lenazoid@yahoo.com>

- Prev by Date:
**Re: st: Perplexed by the SUM function** - Next by Date:
**Re: st: Perplexed by the SUM function** - Previous by thread:
**Re: st: Perplexed by the SUM function** - Next by thread:
**Re: st: Perplexed by the SUM function** - Index(es):

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