Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: displaying summation of a variable


From   "b. water" <[email protected]>
To   [email protected]
Subject   Re: st: displaying summation of a variable
Date   Tue, 24 Jan 2006 19:55:39 +0000

Alan, thank you. The -return list- showed more than the -summarize var, detail- which in this case actually contained the r(sum) giving what I wanted.

regards,
bw



From: Alan Neustadtl <[email protected]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: st: displaying summation of a variable
Date: Tue, 24 Jan 2006 13:24:53 -0500

One way is to use summarize and access the saved result.

For example

sysuse auto
sum price
display "Sum="r(sum)

return list will show you the saved results.

Best,
Alan


On 1/24/06, b. water <[email protected]> wrote:
> dear statalisters,
>
> Stata 8.2 Window XP Pro SP2,
>
> i have a variable 'total', which represents population (no. of persons) per
> observation. what i wanted is quite simple - simply to sum(total) to give
> the overall total no. of person in the dataset. so i did egen
> sumpopn=sum(total), which created a variable sumpopn filled with a constant
> equalling the overall sum, then took a peek at it using display sumpopn. it
> does the job... but is there a shorter way of doing this without -egen- ing
> a new variable (i know i can always -drop sumpopn- later)?
>
> regards,
> bw
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
> *
> * 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/
_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement

*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index