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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: compounding interest


From   Gary Longton <glongton@fhcrc.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: compounding interest
Date   Fri, 23 Jul 2010 11:49:30 -0700

I am not aware of a running product function, but you can always use Stata's running sum function, sum(x), to obtain the running product as a sum of logarithms.

i.e.

 .gen prod_run_x = exp(sum(ln(x)))

- Gary


On 7/23/2010 11:37 AM, Jurgen Sidgman wrote:

Does any one know how to multiply two or more values located in the same column but in different rows?
For example, in the first column I have the following information:
Row 1: 2
Row 2: 3
Row 3: 4
Row 4: 2

What I want to do is to calculate:
Row 1 x Row 2 = 6
Previous result x Row 3 = 24
Previous result x Row 4 = 48
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index