Programming the statistical procedures from SAS

Boxplot with different color for each box ?

Reply
N/A
Posts: 1

Boxplot with different color for each box ?

Hello,

I'm trying to use the cboxfill option with a variable name containing rigth color names within the boxplot procedure but it doesn't want to color them ...

Even if I define the "couleur" variable with "RED" everywhere, it's doesn't work too ... But if I replace cboxfill=couleur by cboxfill=red, all plots are logically red.

Do you have an idea ?

Best wishes,

Marc

Here is my code :


DATA dessin; SET sites.pc_value_sel;
length couleur $8.;
Select (km7b);
when (1) couleur="RED";
when (2) couleur="GREEN";
when (3) couleur="BLUE";
when (4) couleur="BLACK";
when (5) couleur="orange";
when (6) couleur="magenta";
when (7) couleur="brown";
Otherwise;
end;
RUN;

PROC SORT DATA=dessin; BY km7b;

Proc boxplot data=dessin;
plot (H6210_t) * km7b
/ caxis=BLACK
cframe=CXA8A8A8
ctext=BLACK
cboxes=black
cboxfill=couleur
idcolor=black
boxstyle=schematicid
WAXIS=1
haxis=axis1;
run;
SAS Employee Kat
SAS Employee
Posts: 1

Re: Boxplot with different color for each box ?

Hello,

Put the variable name in parenthesis:
cboxfill=(couleur)
Ask a Question
Discussion stats
  • 1 reply
  • 69 views
  • 0 likes
  • 2 in conversation