BookmarkSubscribeRSS Feed
ketch
Calcite | Level 5
Hello.
I am using Proc Boxplot to make a grouped box and whisker plot. I am using annotate to draw brackets between boxes indicating statistically significant pair-wise differences.

How do I get three different color fills inside each of the three locations (Neck, Chest, Groin) and how do I then create a legend outside of the plot area that will include the color definition as well as the p-value labels that I currently have showing inside the plot area?

By the way, I would love to do this using Proc SGPanel. Does anyone know if SGPanel can be "tricked" into somehow adding brackets to a grouped boxplot?

Thanks,
Norma Ketchum

[pre]
goptions reset=goptions fill
device=PNG target=PNG Xmax=8 in Ymax=5 in
Ftext='arial' Ftitle='arial' gunit=pct
XPIXELS=4000 YPIXELS=4000 Htext=3.5 Htitle=3 ;

%annomac
data anno1;
length function style color $ 8 text $23;
retain hsys '3' xsys '3' ysys '3';
size=3; color='black'; function='label';
when='A';

%line(14.0, 75.0, 66.0, 75.0, red, 1,.1);
%line(14.0, 75.0, 14.0, 60.0, red, 1,.1);
%line(66.0, 75.0, 66.0, 74.0, red, 1,.1);
%LABEL (92.0, 84.0, "p<0.01", red, 0, 0, 3.00, arial, E);

%line(24.0, 73.0, 64.0, 73.0, blue, 1,.1);
%line(24.0, 73.0, 24.0, 65.0, blue, 1,.1);
%line(64.0, 73.0, 64.0, 72.0, blue, 1,.1);
%LABEL (92.0, 80.0, "p<0.05", blue, 0, 0, 3.0, arial, E);
run;

proc boxplot data=dose_final;
plot dose*group_loc \ boxwidth=8 cboxes=black cboxfill=lig CONTINUOUS
BOXSTYLE=schematic annotate=anno1
haxis=axis1 vaxis=axis2;
run;
quit;

[/pre]
2 REPLIES 2
GraphGuy
Meteorite | Level 14
If you can't find another way, perhaps this example will be a good starting-place for creating a totally custom boxplot, using annotate to draw it ...

http://robslink.com/SAS/democd47/anno_boxplot_info.htm
http://robslink.com/SAS/democd47/anno_boxplot.htm
http://robslink.com/SAS/democd47/anno_boxplot.sas Message was edited by: Robert Allison @ SAS

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1393 views
  • 0 likes
  • 3 in conversation