Help using Base SAS procedures

Boxplot color

Reply
N/A
Posts: 0

Boxplot color

I have looked at multiple codes for my boxplot syntax yet no matter what I do the box and error bars are red. I would like them black. This is my code:

goptions reset = all;
goptions ftext='swiss' htext=12pt xpixels=1800 ypixels=1500;
symbol interpol=box10 cv=black co=blue bwidth=2 v=dot width=1 height=1;
axis1 major=(n=2 H=1) label=(h=30pt 'Gender') width=2;
axis3 label=(h=30pt "AGE")major=(H=2) minor=(number=2 H=1) width=2;
axis4 label=(h=30pt "BMI") major=(H=2) minor=(number=2 H=1) width=2 ;
run;
proc sort data= box;
by gender;
run;
proc boxplot data= box;
title height=36pt 'Boxplot of Age by Gender';
footnote height=28pt 'Box-25th to 75th
Error Bars-10th to 90th';
plot age*gender/
boxstyle=schematic
boxwidth=10
idsymbol = dot
haxis=axis1
vaxis=axis3;
run;
quit;

Any help on why I can't get black boxes?
Thanks!
Super Contributor
Posts: 260

Re: Boxplot color

Hi.
In the Boxplot procedure, the SYMBOL statement has very little control over the mean representation, and none over the boxes themselves. When you specify INTERPOL=BOX10 -- it is simply ignored. Only the V and colors options are considered for drawing the boxplot. You can change the boxplots color with the CBOXES option in the PLOT statement.
[pre]
plot age*gender/
boxstyle=schematic
boxwidth=10
idsymbol = dot
CBOXES=BLACK
haxis=axis1
vaxis=axis3;
[/pre]
Regards
Olivier
N/A
Posts: 0

Re: Boxplot color

thanks! About what you were saying about the symbol statement does that mean that my Interpol=BOX10 is being ignored too?
Super Contributor
Posts: 260

Re: Boxplot color

The SYMBOL statement has only effect on the point that represent the means. So you can change the symbol itself (V=), its color (C=), but cannot connect them, for example, with I=JOIN. That was what I meant in my post. If you delete the I=BOX10 in your program, I think that your boxplots are generated just the same, aren't they ?
N/A
Posts: 0

Re: Boxplot color

I retried it and your right whether i had the interpol in there or not or even as a different value the graphs were the same. I find that unusual since all of the examples I've seen online are like that too yet supposedly they worked and even in the SAS/graph manual it says to add that in the symbol statement. So I am assuming that this needs to be specified in the same area I just added cboxes, but what termination can I use? I tried both i= and interpol= and neither seem to work. Thank you for all of your help.
Super Contributor
Posts: 260

Re: Boxplot color

In fact, there are 2 different ways to draw boxplots in SAS : 1) in a GPLOT procedure, with SYMBOL INTERPOL=BOX (this is the "old" way) ; 2) in a BOXPLOT procedure, where SYMBOL rules over a lot less options on the graph (the Boxplot proc was introduced in sas 8.0, if I remember well).
So if you run a Boxplot proc without any Symbol statement, the mean is showed as a black plus (+) sign (= the default). If you want to connect these means, you don't use SYMBOL INTERPOL=JOIN, but an option in the Boxplot proc.
Ask a Question
Discussion stats
  • 5 replies
  • 255 views
  • 0 likes
  • 2 in conversation