Here is the code to do your rolling window estimation but with the added enhancement that your initial starting values are based upon the previously estimated model. I would think that this would speed up estimation considerably. SAS Technical support was instrumental in creating this code and should be given full credit. It is a shining example of the skill of our technical support. -Ken /************************************* * generate some data; data a ; do i = 1 to 100 ; x = normal(1) ; y = 2+3*x + rannor(23); output; end; run; %rolling(data=a , outest=est1 ,regn=20 ,totn=45 ); proc print data= est1; run; **************************************/ %macro rolling(data= , outest= ,regn= ,totn= ); * this macro will perform the rolling regressions; * each rolling regression uses estimates from previous rolling window as initial values ; * first rolling window uses estimates using all observations as initial values ; * data= data set name; * outest= OUTEST= data set; * regn= number of obs in each regression; * totn= number of obs in the data set; * clear out the OUTEST= data set; proc datasets lib=work; delete &outest; run; /*use outest from all observations as initial values for the first rolling window*/ proc autoreg data = a outest = _temp_ noprint; model y =x /nlag= 2 garch=(p=1,q=1); run; %do i= ®n %to &totn %by 1; * what is the first obs? ; data _null_; x=&i - ®n +1; call symput('start',trim(left(x))); data _null_; lab='r'||trim(left(&start))||'_'||trim(left(&i)); call symput('label',lab); run; data null ; set _temp_; call symput('int',Intercept); call symput('beta',x); call symput('ar1',_A_1); call symput('ar2',_A_2); call symput('arch0',_AH_0); call symput('arch1',_AH_1); call symput('garch1',_GH_1); run; * run the regression; proc autoreg data=&data(firstobs=&start obs=&i) outest=_temp_ noprint plots = none; &label: model y=x /nlag= 2 garch=(p=1,q=1) initial = (&int &beta &ar1 &ar2 &arch0 &arch1 &garch1); run; * append the OUTEST= data set; proc append base=&outest data=_temp_; %end; %mend; * generate some data; data a ; do i = 1 to 100 ; x = normal(1) ; y = 2+3*x + rannor(23); output; end; run; %rolling(data=a , outest=est1 ,regn=20 ,totn=45 ); proc print data= est1; run;
... View more