In the sample code on the Full Code tab, the discrete attribute map assigns the fill color for each possible value of the Student variable. This ensures that the fill color for each student value is the same even if all possible values are not present for each value of the BY variable.
In the discrete attribute map definition, the NAME= option assigns the name of the attribute definition. A VALUE statement is defined for each possible value of the discrete variable. The DISCRETEATTRVAR statement creates a link between the discrete map definition and the discrete variable. The ATTRVAR= option specifies the name to associate between the attribute map and the input column. The VAR= option points to the input column that you are associating with the map. The ATTRMAP= option points to the name of the discrete attribute map to use in the program. Colors can be expressed as color names, RGB values, or HLS values.
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.
In the sample code below, the discrete attribute map assigns the fill color for each possible value of the Student variable. This ensures that the fill color for each student value is the same even if all possible values are not present for each value of the BY variable.
In the discrete attribute map definition, the NAME= option assigns the name of the attribute definition. A VALUE statement is defined for each possible value of the discrete variable. The DISCRETEATTRVAR statement creates a link between the discrete map definition and the discrete variable. The ATTRVAR= option specifies the name to associate between the attribute map and the input column. The VAR= option points to the input column that you are associating with the map. The ATTRMAP= option points to the name of the discrete attribute map to use in the program. Colors can be expressed as color names, RGB values, or HLS values.
proc template;
define statgraph attributes;
begingraph;
entrytitle 'Students';
discreteattrmap name='colors' / ignorecase=true;
value 'Cindy' / fillattrs=(color=orange );
value 'Susan' / fillattrs=(color=cx8c7962);
value 'Bob' / fillattrs=(color=vlib );
value 'John' / fillattrs=(color=H0DDbf99);
enddiscreteattrmap;
discreteattrvar attrvar=classfill var=student attrmap='colors';
layout overlay ;
barchart x=student y=score / dataskin=gloss group=classfill;
endlayout;
endgraph;
end;
run;
data school;
input Class $ Student $ Score;
datalines;
English Bob 65
English Cindy 80
English Susan 30
English John 90
Math Bob 76
Math John 82
Math Susan 90
;
run;
proc sgrender data=school template=attributes;
by class;
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.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGRENDER |
Date Modified: | 2013-04-30 15:54:01 |
Date Created: | 2013-04-19 12:43:36 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | Base SAS | Aster Data nCluster on Linux x64 | 9.3 TS1M0 | |
DB2 Universal Database on AIX | 9.3 TS1M0 | |||
DB2 Universal Database on Linux x64 | 9.3 TS1M0 | |||
Greenplum on Linux x64 | 9.3 TS1M0 | |||
Netezza TwinFin 32bit blade | 9.3 TS1M0 | |||
Netezza TwinFin 32-bit SMP Hosts | 9.3 TS1M0 | |||
Netezza TwinFin 64-bit S-Blades | 9.3 TS1M0 | |||
Netezza TwinFin 64-bit SMP Hosts | 9.3 TS1M0 | |||
Teradata on Linux | 9.3 TS1M0 | |||
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 |