Sample 43086: Create a grouped bar chart with PROC SGPANEL
This sample uses the SAS® 9.3 GROUPDISPLAY= option to create side-by-side bars with the SGPANEL procedure.
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 SAS® 9.3 GROUPDISPLAY= option to create side-by-side bars with the SGPANEL procedure.
proc format;
value agefmt
low-29 = "Under 30"
30-50 = "30 to 50 Years"
51-70 = "51 to 70 Years"
71-high = "Over 70";
run;
proc template;
define style barcolors ;
parent=styles.htmlblue;
style GraphData1 from GraphData1 /
color=cxffbbcc contrastcolor=black;
style GraphData2 from GraphData2 /
color=lightblue contrastcolor=black;
style GraphFonts from GraphFonts /
'GraphValueFont' = (,10pt)
'GraphLabelFont' = (,12pt);
end;
run;
data heart;
set sashelp.heart;
if deathcause in ("Other" "Unknown") then deathcause="Other/Unknown";
run;
ods html style=barcolors;
title 'Heart Related Deaths';
proc sgpanel data=heart;
format ageatdeath agefmt.;
panelby deathcause / novarname sparse;
vbar ageatdeath / group=sex groupdisplay=cluster clusterwidth=0.8;
rowaxis refticks=(values);
keylegend / title='' noborder;
run;
ods html style=styles.htmlblue;
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 SAS® 9.3 GROUPDISPLAY= option to create side-by-side bars with the SGPANEL procedure.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGPANEL
|
Date Modified: | 2011-05-11 11:14:51 |
Date Created: | 2011-04-27 09:45:50 |
Operating System and Release Information
SAS System | Base SAS | Microsoft Windows Server 2003 Enterprise Edition | 9.3 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.3 TS1M0 | |
Microsoft Windows Server 2003 for x64 | 9.3 TS1M0 | |
Microsoft Windows Server 2008 | 9.3 TS1M0 | |
Microsoft Windows Server 2008 for x64 | 9.3 TS1M0 | |
Microsoft Windows XP Professional | 9.3 TS1M0 | |
Windows 7 Enterprise 32 bit | 9.3 TS1M0 | |
Windows 7 Enterprise x64 | 9.3 TS1M0 | |
Windows 7 Home Premium 32 bit | 9.3 TS1M0 | |
Windows 7 Home Premium x64 | 9.3 TS1M0 | |
Windows 7 Professional 32 bit | 9.3 TS1M0 | |
Windows 7 Professional x64 | 9.3 TS1M0 | |
Windows 7 Ultimate 32 bit | 9.3 TS1M0 | |
Windows 7 Ultimate x64 | 9.3 TS1M0 | |
Windows Vista | 9.3 TS1M0 | |
Windows Vista for x64 | 9.3 TS1M0 | |
64-bit Enabled AIX | 9.3 TS1M0 | |
64-bit Enabled HP-UX | 9.3 TS1M0 | |
64-bit Enabled Solaris | 9.3 TS1M0 | |
HP-UX IPF | 9.3 TS1M0 | |
Linux | 9.3 TS1M0 | |
Linux for x64 | 9.3 TS1M0 | |
Solaris for x64 | 9.3 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.3 TS1M0 | |
Microsoft® Windows® for x64 | 9.3 TS1M0 | |
Z64 | 9.3 TS1M0 | |
z/OS | 9.3 TS1M0 | |