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

st: RE: moving average calculations in STATA?


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: moving average calculations in STATA?
Date   Mon, 28 Jul 2003 12:09:47 +0100

David Brat

> I need to calculate a new variable which takes
> the std. dev. of the previous 80 observations of an
> existing variable.
>
> I have tried the egen and called in for help and reached a dead end.
> I have also tried the egen using "in -80/l" and this did not work.

I believe that -mvsumm- by Kit Baum and myself will serve.
Install it from SSC using -ssc- in Stata 7 or Stata 8.

There is no reason, incidentally, to expect that invoking -in- once
implements moving windows. -in- just selects a fixed
observation range, once and once only.

Nick
n.j.cox@durham.ac.uk

*
*   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