/* Richard A. DeVenezia * www.devenezia.com * * A stacked bar chart example * Posted to SAS-L Oct 19, 2003 */ data foo; array means[0:3]; seed=ranuni(1); do city = 'A', 'B', 'C'; do profession = 'W', 'X', 'Y', 'Z'; do i = 0 to 3; means[i] = 40000+abs(40000*ranuni(0)); end; n = 10000 * ranuni(0) + 100; do i = 1 to n; id + 1; education = int (4*ranuni(0)); salary = means[education] + abs ( 20000 * rannor(0) ) ; salary = int (salary); output; end; end; end; keep city profession education salary; run; proc format; value edu 0 = 'n/a' 1 = 'k12' 2 = 'b/ms' 3 = 'phd' ; run; goptions reset=(all); goptions device=png hsize=5.5in vsize=2.5in gsfname=gout gsfmode=replace ftext='Arial' htext=9pt; filename gout "\\extreme\samples\gchart-example.png"; proc gchart data=foo; vbar education / discrete group=city subgroup=profession sumvar=salary type=mean space=1.25 width=6 gspace=5 ; format education edu.; run; goptions hsize=4.5in vsize=3.5in rotate=landscape vpos=60 hpos=100; filename gout "\\extreme\samples\gchart-example-2.png"; block education / discrete group=city subgroup=profession sumvar=salary type=mean ; run; quit;