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

I have a regression model that I fitted with proc glm. I want to have both observed and predicted values of my response variable. Then I want to group each into 100 groups (by rank) and find AVERAGE and STD per group for each column:

 

      Y              YRank       Yhat        YhatRank

     23                 2             20.2               2

     22.8              2             21.5               3

     15.8              1             16.2               2

     11.2              1              9.8                1

      8.7               1             10                  1

     ...                  ...              ...                 ...

 

So then:

 

group     avg_Y     std_Y     avg_Yhat     std_Yhat

    1          11.9         1.1             9.9             2.1

    2          22.9         1.7            18.2           1.9

    ...           ...           ...               ...               ...

   100         ...          ...                ....              ...

 

Your help would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Did you check the OUTPUT statement in PROC GLM? There's examples towards the bottom and then run a PROC MEANS on your output data set.

https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_glm_syntax17.htm&docsetVersion=15...

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

The output from the OUTPUT statement in PROC GLM will contain the actual Y value, the predicted value and the residual value, if you use the proper options. P=PRED is the option that produces predicted values, R=RESID is the option that produces residual values.

--
Paige Miller
Reeza
Super User
Did you check the OUTPUT statement in PROC GLM? There's examples towards the bottom and then run a PROC MEANS on your output data set.

https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_glm_syntax17.htm&docsetVersion=15...

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 485 views
  • 1 like
  • 3 in conversation