Data visualization with SAS programming

connecting points when using proc sgplot

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

connecting points when using proc sgplot

Hello All,

I'm trying to connect points by using sgplot but it doesn't work. The option connect exists only with vbox statement and not with scatter statement. You find attached the first figure (but points are not connected. In fact every ID has its assessment in every visit and I'm trying to connect every four points which are assessments of each ID). I need also to connect the three points in the second figure . Is there any solution ?  


Accepted Solutions
Solution
‎12-06-2017 06:30 AM
Super User
Super User
Posts: 9,227

Re: connecting points when using proc sgplot

[ Edited ]

Without any code or test data, this is just theory.  But you have the points you want to draw lines between (these would be your scatter points), but isolate the ones you want and set them into other variables, then have a line plot which plots those points.  E.g

proc sgplot...;
  scatter x=x y=y;
  series x=new_varx y=new_vary;
run;

new vars are the ones holding the datapoints of interest.

 

For plenty of examples look here:

https://blogs.sas.com/content/graphicallyspeaking/

View solution in original post


All Replies
Solution
‎12-06-2017 06:30 AM
Super User
Super User
Posts: 9,227

Re: connecting points when using proc sgplot

[ Edited ]

Without any code or test data, this is just theory.  But you have the points you want to draw lines between (these would be your scatter points), but isolate the ones you want and set them into other variables, then have a line plot which plots those points.  E.g

proc sgplot...;
  scatter x=x y=y;
  series x=new_varx y=new_vary;
run;

new vars are the ones holding the datapoints of interest.

 

For plenty of examples look here:

https://blogs.sas.com/content/graphicallyspeaking/

Occasional Contributor
Posts: 15

Re: connecting points when using proc sgplot

Thank you, but making new variables for each id is not needed. We can use the 'group' option is 'series' statement and it will solve the problem. 

☑ This topic is solved.

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

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