Sample 35135: Horizontal bar chart with table information
This example uses the Graph Template Language (GTL) to produce a horizontal bar chart with a table to the left of the bar chart. The graph uses a four-column lattice layout, where the rightmost cell has a labeled bar chart with an embedded table.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample uses the Graph Template Language (GTL) to produce a horizontal bar chart with a table to the left of the bar chart. The graph uses a four-column lattice layout, where the rightmost cell has a labeled bar chart with an embedded table.
proc template;
define statgraph BarTableHorz;
mvar T1 T2 T3 T4 T5 T6 T7 T8 T9
P1 P2 P3 P4 P5 P6 P7 P8 P9;
begingraph;
entrytitle "Professional Golf Statistics for 2007";
layout lattice / columns=4 columngutter=2
columnweights=(.06 .06 .06 .82);
column2headers;
entry halign=right "Age" / textattrs=(size=7pt weight=bold);
entry halign=right "Events" / textattrs=(size=7pt weight=bold);
entry halign=right "Wins" / textattrs=(size=7pt weight=bold);
endcolumn2headers;
/* columns to left of barchart */
layout overlay / walldisplay=none border=false
yaxisopts=(reverse=true type=discrete display=none)
xaxisopts=(display=none offsetmin=0.3 offsetmax=0);
scatterplot y=player x=constant / markercharacter=age markerattrs=(size=0) ;
endlayout;
layout overlay / walldisplay=none border=false
yaxisopts=(reverse=true type=discrete display=none)
xaxisopts=(display=none offsetmin=.3 offsetmax=0);
scatterplot y=player x=constant / markercharacter=events markerattrs=(size=0);
endlayout;
layout overlay / walldisplay=none border=false
yaxisopts=(reverse=true type=discrete display=none)
xaxisopts=(display=none offsetmin=.3 offsetmax=0);
scatterplot y=player x=constant / markercharacter=wins markerattrs=(size=0);
endlayout;
/* barchart with inset */
layout overlay / yaxisopts=(reverse=true display=(tickvalues) tickvalueattrs=(weight=bold))
xaxisopts=(griddisplay=on labelattrs=(weight=bold)
linearopts=(tickvalueformat=(extractscale=true)) );
/* inset */
layout gridded / valign=bottom halign=right border=true opaque=true;
entry "Tiger's 2007 Wins" / textattrs=(weight=bold);
layout gridded /columns=2 ;
entry halign=left T1; entry halign=right P1;
entry halign=left T2; entry halign=right P2;
entry halign=left T3; entry halign=right P3;
entry halign=left T4; entry halign=right P4;
entry halign=left T5; entry halign=right P5;
entry halign=left T6; entry halign=right P6;
entry halign=left T7; entry halign=right P7;
endlayout;
endlayout;
barchart x=player y=Earnings / barlabel=true barlabelformat=dollar12. orient=horizontal
skin=modern outlineattrs=(color=black);
endlayout;
endlayout;
endgraph;
end;
run;
data PGA2007;
input Rank 2. Player & $15. Age Events Rounds CutsMade Top10 Wins Earnings;
retain Constant 1;
label CutsMade="Cuts Made" Top10="Top 10s";
format age events wins 3.0;
datalines;
1 Tiger Woods 33 16 61 16 12 7 10867052
2 Phil Mickelson 38 22 73 16 7 3 5819988
3 Vijay Singh 45 27 101 25 7 2 4728377
4 Steve Stricker 41 23 80 19 9 1 4663077
5 K.J. Choi 38 25 88 20 7 2 4587859
6 Rory Sabbatini 32 23 80 18 10 1 4550040
7 Jim Furyk 38 24 84 20 8 1 4154046
8 Zach Johnson 32 23 78 18 5 2 3922338
9 Sergio Garcia 29 19 67 16 7 0 3721185
10 Aaron Baddeley 27 23 82 19 7 1 3441119
;
run;
data TigerWins;
input Tournament $1-17 Purse : comma12.;
call symput(cats("T",_n_),strip(Tournament));
call symput(cats("P",_n_),put(Purse,dollar11.));
datalines;
Tour Championship $1,260,000
BMW Championship $1,260,000
PGA Championship $1,350,000
WGC: Bridgestone $1,350,000
Wachovia $1,134,000
WGC: CA $1,350,000
Buick Inv. $936,000
;
run;
ods listing close;
ods html image_dpi=100 file='BarTableHorz.html' path='.';
ods graphics / reset noborder width=700px height=400px
imagename='BarTableHorz' imagefmt=gif noscale;
proc sgrender data=PGA2007 template=BarTableHorz;
run;
ods html close;
ods listing;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This example uses the Graph Template Language (GTL) to produce a horizontal bar chart with a table to the left of the bar chart.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGRENDER Query and Reporting ==> Creating Reports ==> Graphical ==> Financial Industry Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Template Language (GTL)
|
Date Modified: | 2009-03-19 09:20:05 |
Date Created: | 2009-03-16 10:47:13 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9.2 TS2M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS2M0 | |
Microsoft® Windows® for x64 | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M0 | |
Microsoft Windows XP Professional | 9.2 TS2M0 | |
Windows Vista | 9.2 TS2M0 | |
64-bit Enabled AIX | 9.2 TS2M0 | |
64-bit Enabled HP-UX | 9.2 TS2M0 | |
64-bit Enabled Solaris | 9.2 TS2M0 | |
HP-UX IPF | 9.2 TS2M0 | |
Linux | 9.2 TS2M0 | |
Linux for x64 | 9.2 TS2M0 | |
OpenVMS on HP Integrity | 9.2 TS2M0 | |
Solaris for x64 | 9.2 TS2M0 | |