BookmarkSubscribeRSS Feed
wryd078
Calcite | Level 5

Hi SAS Community,

 

I'm currently using a macro to run rolling regressions where every year the data size increases, i.e. 2009, 2009-2010, 2009-2011 etc., with the following code. 

 

ods graphics off;
ods listing close;
%macro loopOverYears;
%do i=2009 %to 2018;
ods output ParameterEstimates=Output&i;
proc sort data=import; by GIC_SECT Year;
proc glm data=import;
class GIC_SECT Year;
model logtotal = GIC_SECT Year logrev logassets logcapx gmar levg / solution;
where year<=&i;
run;
 
%if &i = 2009 %then %do;
data AllEstimates;
set output&i;
endYear=&i;
run;
%end;
%else %do;
data output&i;
set output&i;
endYear=&i;
run;
data AllEstimates;
set AllEstimates output&i;
run;
%end;
%end;
ods listing;
%mend;
%loopOverYears;
 
From here, I need to be able to use the coefficients from these regression results to predict next year's logtotal based on next year's independent variables (GIC_SECT Year logrev logassets logcapx gmar levg). For example, I would run a regression for a data subset 2009-2015 and then use these results to predict logtotal in 2016 based on the independent variables in 2016. 
 
Does anyone know how I might accomplish this? 
1 REPLY 1
sbxkoenk
SAS Super FREQ

These three articles should help you out. They give an exhaustive answer to your scoring question.

 

1.

Techniques for scoring a regression model in SAS

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 646 views
  • 0 likes
  • 2 in conversation