BookmarkSubscribeRSS Feed
Jennys
Calcite | Level 5
Hello!
In v 9.2 you can make a horizontal boxplot if you use ods graphics. I am trying to change the color of the boxes, with the option cboxfill. But it doesn´t work. I works fine without ods graphics, but then the plot become vertical. Do I have to change in some templates or something to get the fill colour to be right?

example:
data temp;
input id growth light temp;
cards;
1 4.55 1 1
2 4.24 1 1
3 4.89 1 2
4 4.88 1 2
5 5.01 1 3
6 5.11 1 3
7 5.55 2 1
8 4.08 2 1
9 6.09 2 2
10 5.01 2 2
11 7.01 2 3
12 6.92 2 3
;
run;
*2. Dictionary of variable values for readability;
proc format;
value lightf 1='1=low'
2='2=high';
value tempf 1='1=cold'
2='2=lukewarm'
3='3=warm';
run;
quit;

proc sort data=temp;
by temp;
run;

ods graphics on;
proc boxplot data=temp;
plot growth*temp
/boxstyle=skeletal
horizontal
cboxes=cx153e7e
cboxfill=red;
title 'Fish Growth by Temperature';
format temp tempf.;
run;
ods graphics off;

tks for advice
Br Jenny
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
It says in the BOXPLOT documentation, that if you use ODS GRAPHICS with PROC BOXPLOT, that:
"PLOT statement options used to control the appearance of traditional high-resolution graphs are ignored for ODS Graphics output. "


Doc is here:
http://support.sas.com/documentation/cdl/en/statug/59654/HTML/default/statug_boxplot_sect024.htm

This means that options like CBOXFILL won't work for you. So, if you want to change the fill color, you would have to make a style template change. It is the GraphDataDefault style element that controls the default fill color. In the template below, all of the style attributes will come from the SASWEB style, except for GraphDataDefault color attribute, which has been set to red. Then, the changed template is used, in this example, for ODS HTML.

cynthia

[pre]
ods path work.mytemplt(update)
sasuser.templat(update)
sashelp.tmplmst(read);

proc template;
define style styles.special;
parent=styles.sasweb;
class GraphDataDefault /
color = red;
end;
run;

ods html path='.' gpath='.'
file='hboxplot5.html' style=styles.special;
... your code...
ods html close;
[/pre]
Jennys
Calcite | Level 5
awesome. thank you so much, cynthia! This saved a lot of time for me.

Have a nice summer
Br
Jenny
Jennys
Calcite | Level 5
.
Herwibawa
Calcite | Level 5

My experiment arranged in Split Plot design. How to make a Charts/ Boxplots for Proportions of a Binary Variable ?

data Survival;

  input A $ B $ Block Y;  if Y=1 then 1='Survive'; else 0='Died';

datalines;

A1     B1     1      0

A1     B1     2      1

A1     B1     3      0

A1     B1     4      0

A1     B1     5      0

A1     B2     1      1

A1     B2     2      1

A1     B2     3      1

A1     B2     4      1

A1     B2     5      0

A1     B3     1      1

A1     B3     2      0

A1     B3     3      0

A1     B3     4      1

A1     B3     5      1

A2     B1     1      0

A2     B1     2      0

A2     B1     3      0

A2     B1     4      0

A2     B1     5      0

A2     B2     1      1

A2     B2     2      0

A2     B2     3      0

A2     B2     4      1

A2     B2     5      0

A2     B3     1      1

A2     B3     2      1

A2     B3     3      1

A2     B3     4      0

A2     B3     5      1

A3     B1     1      1

A3     B1     2      0

A3     B1     3      1

A3     B1     4      0

A3     B1     5      0

A3     B2     1      0

A3     B2     2      1

A3     B2     3      1

A3     B2     4      1

A3     B2     5      0

A3     B3     1      0

A3     B3     2      1

A3     B3     3      0

A3     B3     4      1

A3     B3     5      1

;

 

Is it true when it displayed in as shown below ? how to write the codes?

 

original.jpg

 

 

Please help me it is so important for me...

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 ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 2040 views
  • 0 likes
  • 3 in conversation