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

Hi I have to do a boxplot with category "Visits". I want to connect boxes of those visits by mean except one visit "End Of Treatment". So it should be like all visits=boxes are connected by line (mean) and there is one box=EOT that is not. Is it possible ?

 

proc sgplot data=lb3 dattrmap=attrmap ;

vbox result/category=visit connect=mean FILLATTRS=red attrid=hybrid meanattrs=(symbol=circle ) whiskerattrs=(pattern=mediumdash);

xaxis label="Timepoint" ;
Yaxis values=(0 to 30 by 2) ;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

I haven't tried this, but the doc says you can overlay box plots as long as you have same category variable.  So, I suggest you can have two analysis variable columns A & B.  A should have analysis data missing for last category, while B should have data only for the last category.  Then, use VBOX with connect with A and a separate VBOX for B.  Both should have the same category variable.  This will avoid the need to compute the mean values.

 

If this does not work, you can use the methods described in this blog article to overlay custom connect line.

https://blogs.sas.com/content/graphicallyspeaking/2015/12/04/boxplot-with-connect/

 

https://blogs.sas.com/content/graphicallyspeaking/2015/12/06/boxplot-with-connect-using-annotate/

View solution in original post

2 REPLIES 2
GraphGuy
Meteorite | Level 14

Do you have any example data we can use to experiment with?

The line you're wanting could be drawn with sganno (annotate).

 

Jay54
Meteorite | Level 14

I haven't tried this, but the doc says you can overlay box plots as long as you have same category variable.  So, I suggest you can have two analysis variable columns A & B.  A should have analysis data missing for last category, while B should have data only for the last category.  Then, use VBOX with connect with A and a separate VBOX for B.  Both should have the same category variable.  This will avoid the need to compute the mean values.

 

If this does not work, you can use the methods described in this blog article to overlay custom connect line.

https://blogs.sas.com/content/graphicallyspeaking/2015/12/04/boxplot-with-connect/

 

https://blogs.sas.com/content/graphicallyspeaking/2015/12/06/boxplot-with-connect-using-annotate/

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 657 views
  • 0 likes
  • 3 in conversation