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

st: Rolling Returns and simple loop


From   "kelly johnson" <[email protected]>
To   [email protected]
Subject   st: Rolling Returns and simple loop
Date   Sun, 07 Aug 2005 14:10:19 -0400

Hi,

Suppose I have data liek the following:

Date=date
A, B, C are closing prices for stocks A,B, and C respectively.

How can I write a simple program to do the following:

(I) calculate the 10 day rolling returns
(II) caclulate a ratio=10day rollign returns/std. dev.
(II) loop so as to repeat this caclulation across other variables (B,C, etc.)

Thank you!

kj

date A B C
05 Aug 05 43.34 45.27 33.52
04 Aug 05 43.83 45.46 34.06
03 Aug 05 44.55 46.11 34.51
02 Aug 05 44.75 46.51 33.88
01 Aug 05 43.61 44.93 33.3299
29 Jul 05 41.78 45.15 33.34
28 Jul 05 42.02 45.68 34.01
27 Jul 05 41.99 43.65 34.29
26 Jul 05 40.42 37.74 34.15
25 Jul 05 40.88 37.95 33.85
22 Jul 05 41.02 37.95 33.53
.
.
.
21 Jul 03 42.1 37.95 32.94

_________________________________________________________________
Don�t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index