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]

st: Taking products in loops


From   "Sandy Y. Zhu" <sandy.zhu@yale.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Taking products in loops
Date   Mon, 26 Mar 2012 18:44:34 -0400

Hi everyone:

I was just wondering if you would know how to take products in Stata.

Here's how my data looks like:

Event            Return
1                    1.1
1                    1.01
1                    0.99
1                    1.23
1                    1.1
1                    1.34
1                    0.88
2                    0.99
2                    0.87
2                    1.1
2                    1.004
3                    1.02
3                    1.09
3                    0.98
3                    0.98
3                    1.09
3                    1.09
.....                    ............

For each event, I would like to multiply all the numbers under the
column "return" for that event together. At the end of the program, I
would like to output a column with all the "cumulative returns" for
each event. Since each of my events containa  different number of
observations (or returns), I'm wondering if there's a command that can
do that in Stata?

Thank you so much!



-- 
Yours sincerely,

Sandy Y. Zhu
*
*   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