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   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: product of a variable
Date   Sat, 20 Oct 2012 21:54:53 +0100

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/


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