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;
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/
Do you have any example data we can use to experiment with?
The line you're wanting could be drawn with sganno (annotate).
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/
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.
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.