BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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!
5 REPLIES 5
Olivier
Pyrite | Level 9
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
deleted_user
Not applicable
thanks! About what you were saying about the symbol statement does that mean that my Interpol=BOX10 is being ignored too?
Olivier
Pyrite | Level 9
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 ?
deleted_user
Not applicable
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.
Olivier
Pyrite | Level 9
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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2418 views
  • 0 likes
  • 2 in conversation