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

st: Re: 5-years period averages

From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: Re: 5-years period averages
Date   Sun, 26 Oct 2003 19:47:20 -0600

----- Original Message ----- 
From: <[email protected]>
To: <[email protected]>
Sent: Sunday, October 26, 2003 1:01 PM
Subject: st: 5-years period averages

> Dear Statalisters,
> To avoid temporary external shocks effects, I have restructure my balanced
> panel data in a 5-years averages. I used the following program so far but now
> that I want to try the data set in 3-years averages, I found it to be a pain
> if I should type in the full numlist as before.
> I would appreciate therefore any suggestion that avoids me typing the numlist.

I'm not sure I follow, but if you want a 5 or 3 year moving average you could
use -tssmooth ma-

For example, using the Grunfeld data set (webuse grunfeld) a 5 year average for
each variable could be obtained by:

foreach var of varlist invest-kstock {
 tssmooth ma ma5_`var' = `var', window(4 1)


*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index