Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Rolling Return calculation


From   "kelly johnson" <econometrics@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Rolling Return calculation
Date   Tue, 21 Jun 2005 09:32:09 -0400

Hi,

I have a quick question. Suppose I have data like the following:


Date Return Return+1 Rolling Ret
6/21/2005 0.078 1.078 1.078
6/20/2005 0.051 1.051 1.132978
6/19/2005 0.04163 1.04163 1.180144
6/18/2005 0.025 1.025 1.209647
6/17/2005 0.045 1.045 1.264082
6/16/2005 0.045 1.045 1.320965
6/15/2005 0.01 1.01 1.334175
6/14/2005 0.15 1.15 1.534301
6/13/2005 0.004 1.004 1.540438
6/12/2005 0.05 1.05 1.61746
6/11/2005 0.054 1.054 1.704803
6/10/2005 0.045 1.045 1.781519
6/9/2005 0.016 1.016 1.810024


date is the date
return is a percentage return
return +1=return+1

how do i create a rolling return in stata? it has a value of 1 initially. first obs is 1*1.078, the second obs is 1.078*1.1051, and so on.

i have a long data series (1000 obs). how can i code a function to generate this variable?

thanks!

kj

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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   |   What's new   |   Site index