Cameron says
I've been running rolling regressions using C.F. Baum's -rollreg-
routine. The routine is great, but it does require that the data
contains no gaps. Unfortunately my data (grouped by companies) has quite
a few gaps. Annoyingly, I may have many years of data for a company with
only 1 missing observation...(snip)
and has a problem with error 902 on a large data set.
findit 902 returns
[P] error . . . . . . . . . . . . . . . . . . . . . . . . Return
code 902
no room to add more variables due to width;
An attempt was made to add a variable that would have
increased the memory required to store an observation
beyond what is currently possible. You have the following
alternatives:
You're creating a very large number of new variables stub_v, stub_se,
stub_cons, ... and eventually you fill up memory doing so.
I have not seriously considered whether my -rollreg- needs the 'no
gaps' limitation that is imposed by many Stata time series commands. I
will try to look at that. But even if it was relaxed, my routine would
run into the same problem as yours. Say that you have 1000 firms and 20
years per firm; then it will try to create several thousand new
variables, each with 20 obs.
The way around that limitation (which would kill you even in a balanced
panel) is to have your rollreg routine fill in the values of each item
*next to* its observations in the panel (long) format, rather than in
obs. 1/20 of the variable. So the history of firm j's coefficients is
adjacent to their observations, etc. and then you need only one
variable stub_v no matter how many firms (groups) you have in the
panel. Admittedly to use those stored results you may want to reshape
wide, but that way you will be able to create them for an arbitrarily
large panel.