Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: product of a variable


From   Sun Yutao <yutao.sun.statalist@outlook.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: product of a variable
Date   Sun, 21 Oct 2012 13:06:09 +0200

Thanks Nick, that worked.

Also thanks to josé

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Saturday, October 20, 2012 10:55 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: product of a variable

bysort group : gen prod = sum(ln(x))
by group : replace prod = exp(prod[_N])

Also

STB-51  dm71  . . . . . . . . . . . .  Calculating the product of observations
        (help prod if installed)  . . . . . . . . . . . . . . . . . .  P. Ryan
        9/99    pp.3--4; STB Reprints Vol 9, pp.45--48
        extension to egen for producing the product of observations

Nick

On Sat, Oct 20, 2012 at 8:05 PM, Sun Yutao <yutao.sun.statalist@outlook.com> wrote:

> Just a silly question, how do I get the product of every element from a certain variable (the "pi" operator in math) in the dataset?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index