Sample 45663: Bar chart using fill patterns
The sample code on the Full Code tab uses the SAS® 9.3 FILLPATTERN style attribute to add fill patterns to bars generated with the SGPLOT 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.
The sample code below uses the SAS 9.3 FILLPATTERN style attribute to add fill patterns to bars generated with the SGPLOT procedure. You can use COLOR to specify the color of the bars and CONTRASTCOLOR to specify the color for the pattern.
proc template;
define style mypatterns;
parent=styles.listing;
/* The GraphBar element must be included with the
FILLPATTERN option in order to use fill patterns. */
style GraphBar from GraphComponent /
displayopts = "fillpattern";
/* Fill patterns are defined using the FILLPATTERN
style element attribute.
COLOR is used for the bar fill colors
CONTRASTCOLOR is used for the line colors */
style GraphData1 from GraphData1 /
fillpattern = "L3"
color=cxDADAEB
contrastcolor=cx252525;
style GraphData2 from GraphData2 /
fillpattern = "R3"
color=cxBCBDDC
contrastcolor=cx636363;
style GraphData3 from GraphData3 /
fillpattern = "X5"
color=cx9E9AC8
contrastcolor=cxCCCCCC;
style GraphData4 from GraphData4 /
fillpattern = "L5"
color=cx756BB1
contrastcolor=cxBDBDBD;
style GraphData5 from GraphData5 /
fillpattern = "X2"
color=cx6A51A3
contrastcolor=grayaa;
end;
run;
/* Add the STYLE= option in the ODS destination statement */
ods listing style=mypatterns;
ods html style=mypatterns;
title 'Using fill patterns with a bar chart';
data sample;
input mid $ value;
datalines;
A 10
B 20
C 25
D 15
E 25
;
run;
proc sgplot data=sample noautolegend;
vbar mid / response=value group=mid groupdisplay=cluster
grouporder=data dataskin=crisp;
run;
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 FILLPATTERN style attribute to add fill patterns to bars generated with the SGPLOT procedure.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGPLOT
|
Date Modified: | 2012-02-20 09:29:56 |
Date Created: | 2012-02-14 12:34:22 |
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.3 TS1M0 | |
Microsoft® Windows® for x64 | 9.3 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.3 TS1M0 | |
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 | |