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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.