Dear Statalisters,

I have a question about the results after the rangestat command.

Suppose I input the following dataset:

Code:
input firmid sales year industry
1 10 1999 11
2 5 1999 11
5 19 1999 11
3 7 1999 22
4 2 1999 22
6 4 1999 22
1 8 2000 11
2 6 2000 11
5 12 2000 11
3 9 2000 22
4 3 2000 22
6 3 2000 22
end
I would like to compute average sales by a given industry and a given year excluding the focal firm. In addition, I would like to compute the moving average of this number, say over the last 2 years.

Code:
rangestat (mean) sales_av=sales, by(industry) excludeself interval(year 0 0)
rangestat (mean) sales_ma=sales, by(industry) excludeself interval(year -1 0)
list
     +------------------------------------------------------+
     | firm   sales   year   industry   sales_av   sales_ma |
     |------------------------------------------------------|
  1. |    1      10   1999         11         12         12 |
  2. |    2       5   1999         11       14.5       14.5 |
  3. |    5      19   1999         11        7.5        7.5 |
  4. |    3       7   1999         22          3          3 |
  5. |    4       2   1999         22        5.5        5.5 |
     |------------------------------------------------------|
  6. |    6       4   1999         22        4.5        4.5 |
  7. |    1       8   2000         11          9       10.4 |
  8. |    2       6   2000         11         10       10.8 |
  9. |    5      12   2000         11          7        9.6 |
 10. |    3       9   2000         22          3        3.8 |
     |------------------------------------------------------|
 11. |    4       3   2000         22          6          5 |
 12. |    6       3   2000         22          6          5 |
     +------------------------------------------------------+
It is clear how one gets average sales (sales_av) of 10 for firm 2 in 2000, that is (8+12)/2 where the value of 6 for the focal firm is excluded from the calculation. The moving average sales (sales_ma) for firm 2 in year 2000 is 10.8. Shouldn't it be (10+14.5)/2=12.25 instead of 10.8?