BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MonaG
Calcite | Level 5

Hi,

 

I am trying to use proc model to run a time series regression yt = A*xt by 10 group ids and then use the regression result to forecast y(t+1) at x(t+1).  The coefficients came out with 10 groups. However the forecast result came out just as one group. I wonder how can I generate forecast by groups as well. My code is as follows.

 

data shock1; *generate x1 to xt then forecast y at x(t+1) and x(t+2)
r = 0; * 5 lagged values assumed be zero;
do i=1 to 5; output; end;
i=6; * impulses;
r = 1; output shock1;
r = .; * future values;
do i=7 to 8; output; end; run;

 

proc model data=regdata;
by groupID;
r = A1*lag5(1,r)+A2*lag5(2,r)+A3*lag5(3,r)+A4*lag5(4,r)+A5*lag5(5,r);

fit r/ sur outs=vcov (drop=_nused_) outest=est out=res;
solve / forecast data=shock1 out=prediction;

The out=prediction dataset only generate one group of forecast without groupID. I need the forecast to be also by groupID. I would appreciate it very much if anyone could help me on this.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Should Shock1 have a groupID? 

View solution in original post

2 REPLIES 2
Reeza
Super User

Should Shock1 have a groupID? 

Ksharp
Super User
Plz post it at forecast forum ,since it is about SAS/ETS

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1069 views
  • 0 likes
  • 3 in conversation