Overlaying a line

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

Overlaying a line

Hi, I have two variables I'd like to plot out using a scatter plot. I'd also like to add onto that same plot a line at a 45 degree angle. What is the best way to go about doing this? Thanks!


Accepted Solutions
Solution
‎01-20-2016 11:08 AM
Super User
Posts: 9,865

Re: Overlaying a line

proc sgplot data=sashelp.class aspect=1;
 scatter x=weight y=height/group=sex;
 lineparm x=0 y=0 slope=1;
run;

View solution in original post


All Replies
Super User
Posts: 11,107

Re: Overlaying a line

This shows one way to generate the line over a scatter plot. Add a second scatter plot statement for the second variable.

http://support.sas.com/kb/49/302.html

Super Contributor
Posts: 490

Re: Overlaying a line

Solution
‎01-20-2016 11:08 AM
Super User
Posts: 9,865

Re: Overlaying a line

proc sgplot data=sashelp.class aspect=1;
 scatter x=weight y=height/group=sex;
 lineparm x=0 y=0 slope=1;
run;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 291 views
  • 0 likes
  • 4 in conversation