Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: summing the values of all observations of a variable inStata 8.2


From   Suzy <scott_788@wowway.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: summing the values of all observations of a variable inStata 8.2
Date   Fri, 10 Jun 2005 19:00:00 -0400

Thank you!

Richard Williams wrote:

At 06:27 PM 6/10/2005 -0400, Suzy wrote:

Hi Statamembers,

Is there an easy command to sum the values of all observations of a variable. I've searched the internet for info, but haven't found anything yet.

For example:

ID bmi
1 26
2 18
3 20

SUM bmi = 64

. summarize bmi

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
         bmi |         3    21.33333    4.163332         18         26

. display r(sum)
64


Another way:

. egen sumbmi = sum(bmi)



-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX:    (574)288-4373
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW (personal):    http://www.nd.edu/~rwilliam
WWW (department):    http://www.nd.edu/~soc

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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