<>
Ari wants to take a very hard look at ?h rolling- which will solve his
problem. Here is a first stab at a solution:
******
clear*
set obs 100
//firms
gen firm=_n
lab var firm "Firm ID"
//expand to # of time periods
expand 10
bys firm: gen year=_n
gen M=rnormal()
compress
tsset firm year
qui rolling r(sd), /*
*/ window(2) recursive /*
*/ clear start(1) : su M
rename _stat_1 standev
l if firm<=4, /*
*/ sepby(firm) noo
******
HTH
Martin
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/