gchart

Bar chart

Customise bar segment color by using Pattern. This seems to be the easiest way to set custom color for bar charts.

Sgplot vbar/hbar seems have to set it through style and output to ods pdf/html which is very crappy.

The subgroup in gchart is similar to the stacked bar in sgplot.

The group in gchart is similar to the clustered bar in sgplot.

The inside is the aggregation function. Some aggregate function needs the input variable as well (e.g sumvar). 

data sample;

input name $ sex $ age height fitness;

datalines;

Alfred M 14 69 1

Alice F 13 56.5 1

Barbara F 13 65.3 2

Carol F 14 62.8 1

Henry M 14 63.5 2

James M 12 57.3 1

Jane F 12 59.8 2

Janet F 15 62.5 1

Jeffrey M 13 62.5 2

John M 12 59 1

Joyce F 11 51.3 1

Judy F 14 64.3 2

Louise F 12 56.3 2

Mary F 15 66.5 1

Philip M 16 72 1

Robert M 12 64.8 1

Ronald M 15 67 2

Thomas M 11 57.5 1

William M 15 66.5 2

;

pattern1 color = pink;

pattern2 color = blue;

proc gchart data = sample;

vbar age / inside=sum sumvar=height group=sex subgroup=fitness;

run;