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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.