BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bkq32
Quartz | Level 8

I'm running a simple linear regression of WEIGHT_1 vs WEIGHT_2.

 

proc reg data=have;
 model weight_1 = weight_2;
run;

How can I add an identity line to the fit plot and make the axis ranges the same?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Consider using SGPLOT instead?
You can use the REG statement, then use a LINEPARM statement for the identity line and you have full control of the axis using the XAXIS/YAXIS statements.

View solution in original post

2 REPLIES 2
Reeza
Super User
Consider using SGPLOT instead?
You can use the REG statement, then use a LINEPARM statement for the identity line and you have full control of the axis using the XAXIS/YAXIS statements.

bkq32
Quartz | Level 8

Thank you, @Reeza. In order to keep the ANOVA and parameter estimates that I'd get from PROC REG, I'm thinking I'll just piece the output from PROC REG and PROC SGPLOT together.

 

data have;
 input id weight_1 weight_2;
 cards;
1 80 81
2 150 155
3 190 170
4 201 203
5 204 211
6 180 188
7 170 171
8 177 169
9 90 82
10 99 101
;
run;


ods trace on;
proc reg data=have;
 model weight_1 = weight_2;
 
 ods exclude diagnosticspanel;
 ods exclude residualplot;
 ods exclude fitplot;
run;


proc sgplot data=have;
 title "Fit Plot for weight_1";
 reg y=weight_1 x=weight_2 / cli clm;
 lineparm x=0 y=0 slope=1 / lineattrs=(color=red);
 xaxis values=(50 to 250 by 50);
 yaxis values=(50 to 250 by 50);
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 444 views
  • 0 likes
  • 2 in conversation