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

st: RE: Rolling Returns and simple loop

From   "Nick Cox" <>
To   <>
Subject   st: RE: Rolling Returns and simple loop
Date   Sun, 7 Aug 2005 19:52:38 +0100

It is bad, not good, Statalist psychology to 
claim a "simple question". I know that some 
gurus have a habit of immediately deleting emails 
with similar preambles. 

First, the question may seem simple to you, 
but the answer may not be, so you gain nothing
by an appeal to your expectation that an expert
should be able to give an instant answer. 

Second, if you think it's that simple, 
what's stopping you from solving it? 
What code did you try? 

That said, I have no idea of what "rolling returns" are, 
but I guess that no program is needed here. 

-rolling- should yield (I), while a standard
-foreach- loop around variables should yield 
your second (II). 


kelly johnson
> 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.)

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index