Help using Base SAS procedures

Boxplot gender

Posts: 0

Boxplot gender

I am creating a boxplot of ethnicity stratified by gender. I want a box for males and one for females right next to eachother representing each ethnicity, is there a way to make the boxes side by side and not overlapping?

This is my graph code:
goptions reset = all;
goptions ftext='swiss' htext=12pt xpixels=1800 ypixels=1500;
symbol1 interpol=boxt10 cv=black co=black bwidth=15 v=dot width=1 height=1;
symbol2 interpol=boxt10 cv=red co=red bwidth=15 v=dot width=1 height=1;
symbol1 cv=black co=black v=dot width=1 height=1;
symbol2 cv=red co=red v=dot width=1 height=1;
axis1 major=(n=2 H=1) label=(h=30pt 'Gender') width=2 offset=(25pct);
axis2 major=(n=3 H=1) label=(h=30pt 'Ethnicity') width=2 offset=(10pct);
axis3 label= (a=90 r=0 F='swiss' 'Predicted Clearance') order=0 to 160 by 20;

I have specified a seperate color for both men and women and added a legend so that you can tell them apart.
This is my plotting code:

proc gplot data= cl2;
title height=36pt 'Boxplot of Predicted V3 by Ethnicity Stratified by Gender';
footnote height=28pt 'Box-25th to 75th
Error Bars-10th to 90th';
plot Predicted_cl*ethnicity= gender/

my result is a boxplot by ethnicity with sperate color boxes for males and females overlapping one another.

Is there a way that I can make males and females side by side so that the graph is easier to read?

Trusted Advisor
Posts: 2,113

Re: Boxplot gender

Check the documentation for PROC BOXPLOT. It think it has the option you want.

Otherwise, you could do it in PROC GPLOT by doing a separate plot for each level of ethnicity and then using GREPLAY to re-assemble the pieces (clumsy, but it might get you to the answer if you need other features of GPLOT).

Doc Muhlbaier
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation