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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.