forvalues i = `min'/`=`max' - `move' + 1' {
local j = `i' + `move' - 1
if `j' <= `total' {
capture regress `depvar' `reglist' in `i'/`j'
replace rc = _rc in `j'
if _rc == 0 & e(N) == `move' {
tempvar res
predict `res' if e(sample), res
summarize `res'
replace `stub'_sd_residual = `res' in `j'
replace `stub'_r2 = e(r2_a) in `j'
replace `stub'_RMSE = e(rmse) in `j'
replace `stub'_N = e(N) in `j'
replace `stub'_cons = _b[_cons] in `j'
replace `stub'_se_cons = _se[_cons] in `j'
forvalues l = 2/`k' {
local v: word `l' of `varlist'
replace `stub'_`v' = _b[`v'] in `j'
replace `stub'_se_`v' = _se[`v'] in `j'
}
}
}
}
local min = `max' + 1
}
}
end