# RE: st: calculating moving standard deviation

 From "Yatawara, Ravi" <[email protected]> To <[email protected]> Subject RE: st: calculating moving standard deviation Date Tue, 14 Jun 2005 11:54:35 -0400

```Hello folks,

For a panel dataset, I am trying to create a standardized score
variable, by  country  by  year  but am calculating it on a moving
average basis. I have 50 countries for the 1960-2000 period.  For
example,  a standardized score of period t,  (ZXt) is calculated
Xt minus mean (Xt, Xt-1 Xt-2 ), all divided by the standard deviation
of (Xt, Xt-1 Xt-2 )
Thus the ZXt+1=  Xt+1 minus mean (Xt+1 Xt Xt-1 ), all divided by the
standard deviation of (Xt+1, Xt Xt-1)

I am calculating the mean by creating new variables of the lagged values
of X and then averaging them.
Any ideas on how I can get the standard deviation of just the 3 moving
years, ( NOT my  full sample period 1960-2000) by country.
Any feedback would be much appreciated.
ravi

/

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