Chapter Contents

Previous

Next
The GCHART Procedure

Example 4: Subgrouping a 3D Vertical Bar Chart


Procedure features:
VBAR statement options:
CFRAME=
INSIDE=SUBPCT
LEGEND=
MAXIS=
OUTSIDE=SUM
RAXIS=
SPACE=
SUBGROUP=
WIDTH=
Other features:
AXIS statement
FORMAT statement
GOPTIONS statement
OFFSHADOW=
LEGEND statement
PATTERN statement
Data set: TOTALS
Sample library member: GR13N04

[IMAGE]

This example subgroups by department the 3D vertical bar chart of total sales for each site that is shown in Specifying the Sum Statistic in Bar Charts. In addition to subdividing the bars to show the amount of sales for each department for each site, the chart displays statistics both inside and outside of the bars. OUTSIDE=SUM prints the total sales for the site above each bar. INSIDE=SUBPCT prints the percent each department contributed to the total sales for its site inside of each subgroup segment.

The legend has a block-effect shadow whose color matches the backplane. The graphics option OFFSHADOW= defines the size and position of the block shadow. Both the LEGEND statement and the AXIS statement use the ORIGIN= option to line up the legend and the chart by explicitly positioning their lower left corners.
 Note about code
libname reflib 'SAS-data-library';
goptions reset=global gunit=pct border cback=white
         colors=(black red green blue) ftitle=swissb
         ftext=swiss htitle=6 htext=4
         offshadow=(1.5,1.5);
 Note about code
title1 'Total Sales by Site';
footnote1 h=3 j=r 'GR13N04 ';
 Note about code
axis1 label=none
      origin=(24,);
 Note about code
axis2 label=none
      order=(0 to 100000 by 20000)
      minor=(number=1)
      offset=(,0);
 Note about code
legend1 label=none
        shape=bar(3,3)
        cborder=black
        cblock=gray
        origin=(24,);
 Note about code
pattern1 color=lipk;
pattern2 color=cyan;
pattern3 color=lime;
 Note about code
proc gchart data=reflib.totals;
   format quarter roman.;
   format sales dollar8.;
   vbar3d site / sumvar=sales
                 subgroup=dept
                 inside=subpct
                 outside=sum
                 width=9
                 space=4
                 maxis=axis1
                 raxis=axis2
                 cframe=gray
                 coutline=black
                 legend=legend1;
run;
quit;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.