Previous Page | Next Page

The GCHART Procedure

Example 2: Grouping and Subgrouping a Block Chart


Procedure features:

BLOCK statement options:

CAXIS=

GROUP=

LEGEND=

MIDPOINTS=

NOHEADING

SUBGROUP=

TYPE=

Other features:

GOPTION statement option:

BORDER

LABEL statement

LEGEND statement

Default pattern rotation

Sample library member: GCHBKGRP

[GCHBKGRP-Grouping and subgrouping in a block chart]

This example shows average quarterly sales for each department at two of the three manufacturing sites in the TOTALS data set; it excludes the Paris site from the chart.

The program groups the chart data (sites) by department, and subgroups department sales data by quarter. Each site is a midpoint. Because the sites are grouped by department, each midpoint has a separate square for each department and the height of the block represents total sales for that department.

The blocks are subgrouped to show how quarterly sales contribute to total sales; each segment represents sales for a quarter. A legend explaining the subgroup patterns appears below the midpoint grid.

The subgroups use four default patterns and colors which are retrieved from the current style. The patterns are created by rotating the default fill, solid, through the color list that is defined in the current style.

 Note about code
goptions reset=all border;
 Note about code
data totals;
length dept $ 7 site $ 8;
input dept site quarter sales;
datalines;
Parts Sydney 1 3043.97
Parts Sydney 3 5142.63
Parts Atlanta 1 5225.26
Parts Atlanta 2 3529.06
Tools Sydney 4 1775.74
Tools Atlanta 4 3424.19
Repairs Sydney 2 5543.97
Repairs Atlanta 1 3788.93
Repairs Atlanta 2 4492.89
Repairs Atlanta 3 3914.25
;
 Note about code
title "Average Sales by Department";
footnote j=r "GCHBKGRP ";
 Note about code
legend1 cborder=black
label=("Quarter:")
position=(bottom right outside)
mode=protect
across=1;
 Note about code
proc gchart data=totals;
format quarter roman.;
format sales dollar8.;
label site="00"x dept="00"x;
 Note about code
block site / sumvar=sales
type=mean
midpoints="Sydney" "Atlanta"
group=dept
subgroup=quarter
legend=legend1
noheading;
run;
quit;

Previous Page | Next Page | Top of Page