By "returns test for July of year t" do you mean a window ending June 30 of year t, or do you mean a window endow July 31 of year t?
Do you only want the "July" windows, or do you want windows for every month? And if you mean every month, then are you still saying you want December data for year t-1, or do you merely mean 7 months prior to the window ending month?
It appears you want 36-month long windows, but will accept up to 12 monthly "holes" in that 36 months, correct? Which means, at the beginning of your time series, you can have a 24-month window, then a 25-month windows, etc.
For a company with complete monthly data for Jan 1980 through Dec 2010, (31 years), there will 31*12 - 23 = 349 regressions for each PERMNO. So if you have, say, 500 firms, you'll be constructing 174,500 windows. PROC SQL, which is in the macro you found, is not an efficient way to prepare this data. Since crsp/compustat data are almost certainly sorted by permno/date (they are at WRDS), you'll be better off either using a data step make window raw data set view, or possibly a view+proc expand to create rolling sums-of-squares for the regression.
... View more