Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Monthly returns compounded annually for various companies


From   Alexander Vogt <[email protected]>
To   [email protected]
Subject   st: Monthly returns compounded annually for various companies
Date   Tue, 22 Feb 2011 17:59:17 +0100

Hello,

I'm stuck with the following problem: 

I'd like to compound annual returns for various companies using monthly return data from CRSP. 

Here is a snippet from the data (12 months for each comp_cd) the compounded rates should be stored in return_cum):

comp_cd	year		month		return		ret_1		return_cum
14234		1992		1			.0133		1.0133
14234		1992		2			-.0235		0.9765
(...)
14235		1993		1			.0432		1.0432
14235		1993		2			-.0324		0.9676
(...)

So far, I've tried the following command (and experimented with foreach), but my output doesn't make too much sense:

by comp_cd (year): gen return_cum = exp(sum(log(ret_1)))

It would be great, if anyone could help me out!

Many thanks,
Alex
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index