![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS/GRAPH Software: Reference |
Sample library member: GR08N07
This example uses a BY statement with the GCHART procedure to produce a separate 3D vertical bar chart for each value of the BY variable TYPE. The three charts, which are shown in Output for BY Value Corn, Output for BY Value Rice, and Output for BY Value Wheat following the code, show leading grain producers for 1995 and 1996.
libname reflib 'SAS-data-library';
goptions reset=global gunit=pct border cback=white
colors=(black blue green red)
ftitle=swissb ftext=swiss htitle=5
htext=4 hsize=5in vsize=5in;
data reflib.grainldr; length country $ 3 type $ 5; input year country $ type $ amount; megtons=amount/1000; datalines; 1995 BRZ Wheat 1516 1995 BRZ Rice 11236 1995 BRZ Corn 36276 ...more data lines... 1996 USA Wheat 62099 1996 USA Rice 7771 1996 USA Corn 236064 ;
Create a format for the values of COUNTRY.
proc format;
value $country 'BRZ' = 'Brazil'
'CHN' = 'China'
'IND' = 'India'
'INS' = 'Indonesia'
'USA' = 'United States';
run;
options nobyline;
title1 'Leading #byval(type) Producers'
j=c '1995 and 1996';
footnote1 j=r h=3 'GR08N07 ';
pattern1 color=green;
axis1 order=(0 to 550 by 100)
label=(angle=90 'Millions of Metric Tons')
major=none
minor=none
value=none
style=0
noplane;
axis2 label=none
split=' ';
proc sort data=reflib.grainldr out=temp;
by type;
run;
proc gchart data=temp (where=(megtons gt 31))
gout=reflib.excat;
by type;
format country $country.;
vbar3d country / sumvar=megtons
outside=sum
descending
shape=hexagon
width=8
coutline=black
cframe=grayaa
maxis=axis2
raxis=axis1 name='gr08n07';
run;
quit;
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.