I have regression model of the form Y = X + X^2. I need to plot the observed and the predicted values of Y against X on the same plot. I am thinking of using the overlay option in PROC REG.
OUTPUT P gives the predicted values as far as I understood. But how do I save it in a variable, say Yhat?
How do I get the predicted values from the regression summary to write the statement plot Y*X Yhat*X/overlay ;
Thank You.
In PROC REG, in the PLOT statement, you get the predicted values via
plot y*x predicted.*x/overlay;
In PROC REG, in the PLOT statement, you get the predicted values via
plot y*x predicted.*x/overlay;
You can get more control over the graph appearance with proc sgplot. For example:
proc sgplot data=sashelp.heart noautolegend;
reg x=ageAtStart y=cholesterol / degree=2 cli
markerattrs=(symbol=circlefilled size=4) transparency=0.2;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.