Can someone tell me how to modify a correlation plot to have the same scale for the x and y axis that begins at the origin?
When I use my current code below, my graph "zooms in", but I want to display it differently.
ods graphics on;
PROC CORR DATA=TBI1 PLOTS=SCATTER(NVAR=all);
VAR D16MWT D26MWT;
RUN;
ods graphics off;
graph:
Thank you in advance!
It sounds like you should use PROC SGPLOT if you want complete control over axes ranges. Compare the following two plots:
proc corr data=sashelp.class plots=scatter;
var weight height;
run;
title "Scatter Plot";
title2 "With 95% Prediction Ellipse";
proc sgplot data=sashelp.class;
scatter x=weight y=height;
ellipse x=weight y=height;
xaxis min=0; /* do you also want MAX=500 ? */
yaxis min=0; /* do you also want MAX=500 ? */
run;
I'm not sure if " the same scale for the x and y axis" means that you also want the maximum value for each axis to be the same. If so, use the MAX= option on the XAXIS and YAXIS statements, as shown in the comments.
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 25. 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.