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: Create a 'rolling-mean' variable


From   Léon Bueckins <l.bueckins@zeppelin-university.net>
To   statalist@hsphsun2.harvard.edu
Subject   st: Create a 'rolling-mean' variable
Date   Thu, 4 Nov 2010 17:17:08 +0100

Hi,

this might be a rather simple questions, but I don't get it to work, so help is appreciated.

I try to generate a variable that is simply the mean value of another up to this point in time, so a kind of rolling-mean. Example:

var_x | var_mean
1| 1/1
4 | 5/2
3 | 8/3
7 | 15/4
2 | 17/5

Regards,

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