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

From |
Lena Cuisina <lenazoid@yahoo.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Perplexed by the SUM function |

Date |
Mon, 16 Mar 2009 15:05:02 -0700 (PDT) |

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/

**Follow-Ups**:**Re: st: Perplexed by the SUM function***From:*Friedrich Huebler <fhuebler@gmail.com>

**Re: st: Perplexed by the SUM function***From:*"Martin Weiss" <Martin.Weiss1@gmx.de>

**Re: st: Perplexed by the SUM function***From:*Eva Poen <eva.poen@gmail.com>

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

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