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: [email protected]
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/