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!
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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.