Hi
I estimate a structural vector autoregression, imposing long-term restrictions, and estimate the structural shocks below.

My question is how I can adjust my code to produce the structural shocks in a rolling fashion, (1) using a fixed window of say 40 observations, and (2) using recursive i.e., increasing windows with an initial window if 40 obs.

Code:
matrix c=(.,0\.,.)
svar Y X, lags(1/4) lreq(c)  
*Get structural shocks
matrix B=e(B)
predict e1, res eq(Y)
predict e2, res eq(X)
mkmat e1 e2, matrix(e)
matrix eta=(inv(B)*e')'
svmat eta
Hope someone can help