Programming the statistical procedures from SAS

Proc Reg / GLM

Reply
N/A
Posts: 1

Proc Reg / GLM

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?
Trusted Advisor
Posts: 2,114

Re: Proc Reg / GLM

Try the ESTIMATE statement. I think that something like this would work:

ESTIMATE 'Spending is 45' spending 45/CLPARM;
Frequent Contributor
Posts: 77

Re: Proc Reg / GLM

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
Ask a Question
Discussion stats
  • 2 replies
  • 141 views
  • 0 likes
  • 3 in conversation