11-22-2016 10:43 PM - edited 11-22-2016 10:44 PM
I am a new user of Sas but I have to try macro for rolling regression 12 months, shift one month forward. I did this one and it can run well for PROC REG with OUTEST. So I want to rewrite it for getting residual variable from OUTPUT, I tried many times and it is not working in every loop order. I did change one part like this:
proc reg data=&data;
where &date between &idate1 and &idate2;
output out=_outest_ds r=resid
%* Add loop date range variables to output set;
regobs= _p_ + _edf_; %* number of observations in regression; I delete this line because edf is from outest, but I changed it into OUTPUT and do not know how to count regressors.
%if &year_date=0 %then format date1 date2 date9.;
THE CODE THAT I RUN FROM THE LINK BELOW and I can get the results of R-square correctly with rolling window 12 months.
I REALLY APPRECIATE YOUR HELP. I AM UNDER STRESSED NOW.
11-22-2016 11:15 PM
11-23-2016 01:05 AM
Thank you, I did try it in simple form but the problem is rolling window for proc reg, I cannot create rolling loops because huge data. So I found this one and it works.
11-23-2016 10:45 PM
What is the code that you used for PROC REG with OUTEST. I am struggling to run a rolling regression for my data as well. I referred to the same article that you did but I dint come up with the right code yet.
11-24-2016 01:53 AM