Michael Blasnik
> If there are no missing data, then a quick approach to get
> a 7 period moving
> sum is:
>
> bysort subject (day) : gen exer_cum=sum(exercise)
> by subject: gen exer_sum7=exer_cum-exercum[_n-6]
>
This is a very cute method. It should give
results equivalent to the time series methods
_unless_ there are gaps in the data, i.e. not
all dates are consecutive within panels.
(I think this is what Michael means by his
reference to missing data.)
Nick
[email protected]
*
* 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/