Dear all,

We are stuck with a problem regarding the calculation of rolling averages only for even firm years over a period of 5 years, using the current and previous years. We used the rangestat command but we were not able to restrict this calculation to only run for the even years.

this is the code we ran;

ssc install rangestat
rangestat (sd) two_rev, interval (year -8 0) by (Company)

Company-year-expenses-volatility(wanted)
1-2003-2-.
1-2004-3-*
1-2005-4-.
2-2002-5-
*
2-2003-5-.
2-2004-6-*
3-2000-2-*
3-2001-4-.
3-2002-5-
*
3-2003-6-.
3-2004-5-
*
3-2005-8-.
3-2006-5-
*
3-2007-8-.
3-2008-12-value
3-2009-3
3-2010-6-value
3-2011-6
3-2012-5-value

*=missing value

For some reason rangestat gives for the years 2008, 2010 and 2012 the same value. It seems like the whole interval is not taken into account.

We hope someone can help us with this problem!

Thanks in advance,

Jonathan