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

From |
Simon Moore <simoncmoore@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
Mon, 16 Mar 2009 22:16:13 +0000 |

Hi Lena, Try egen gh_raw = rowtotal(gh1 gh2 gh3 gh4 gh5) Simon Lena Cuisina wrote: > 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/ > * * 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/

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

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