Sample 43731: Create a graph with PROC SGPLOT with colors defined using an attribute map
This samples uses an attribute map with PROC SGPLOT to associate a specific data value with a fill color for the graph. This sample code requires SAS® 9.3 or higher.
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 samples uses an attribute map with PROC SGPLOT to associate a specific data value with a fill color for the graph. This sample code requires SAS® 9.3 or higher.
data icecream;
input flavor $10. sex $ count;
datalines;
Vanilla M 80
Chocolate M 45
Strawberry M 22
Chocolate F 65
Vanilla F 50
;
run;
data attrmap;
input id $ value $10. @19 fillcolor $8. linecolor $8.;
datalines;
flavor Vanilla beige black
flavor Chocolate cx663D29 black
flavor Strawberry pink black
;
run;
proc format;
value $ fmt
'F'='Female'
'M'='Male';
run;
title 'Favorite Ice Cream Flavor';
proc sgplot data=icecream dattrmap=attrmap;
format sex $fmt.;
vbar sex / group=flavor response=count groupdisplay=cluster
dataskin=pressed attrid=flavor;
xaxis display=(nolabel noticks);
yaxis label='Count of Participants';
keylegend / title='Ice Cream Flavor';
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 samples uses an attribute map with PROC SGPLOT to associate a specific data value with a fill color for the graph. This sample code requires SAS® 9.3 or higher.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> SGPLOT
|
| Date Modified: | 2011-11-03 10:47:23 |
| Date Created: | 2011-07-13 09:29:04 |
Operating System and Release Information
| SAS System | Base SAS | z/OS | 9.3 TS1M0 | |
| Z64 | 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 | |