BookmarkSubscribeRSS Feed
kisam
Calcite | Level 5
Hello,

I have a question about Proc Reg or GLM about prediction. I was trying to use proc reg and proc glm to make prediction. I have a code as follow:

proc glm data=Sports_Wins_vs_Spending;
model wins = spending / P;
run;
quit;

Let's say I have the following data:
Wins Spending
30 50
35 55
60 57
44 68

The option "P" gives me the predicted value at each of the spending level that I have in the dataset (50, 55, 57, 68). However, there is a specific Spending I would like to use to predict the Number of Wins for the team. Can anyone tell me what would be the code to specify the Spending that I want (say, 45) in the model and get the predictive boundary (say 95%) for that predicted value?
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
Try the ESTIMATE statement. I think that something like this would work:

ESTIMATE 'Spending is 45' spending 45/CLPARM;
statsplank
Calcite | Level 5
Hi,

You may want to try the following code:


data s;
input wins spending;
datalines;
30 50
35 55
60 57
44 68
. 45
;

proc reg data=s;
model wins=spending;
output out=predict
p=wins_pred
LCL=wins_95LCL
UCL=wins_95UCL ;

proc print data=predict(where=(wins=.)) noobs;
run;


In the output window you'll see predicted wins (wins_pred) for spending=45 along with the lower (wins_95LCL) and upper (wins_95UCL) bounds of 95% CI for an individual prediction.

More about an OUTPUT statement in PROC REG:
http://support.sas.com/documentation/cdl/en/statug/59654/HTML/default/statug_reg_sect015.htm Message was edited by: statsplank

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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