Sample 41776: Create a map with colors defined from a color ramp
The sample code on the Full Code tab uses the TwoColorRamp style element in PROC TEMPLATE to define the starting and ending colors for a color ramp.
To view a sample that produces a list of SAS/GRAPH colors, see
SAS Sample 31471, "Display the SAS/GRAPH® named colors."
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 TwoColorRamp style element in PROC TEMPLATE to define the starting and ending colors for a color ramp.
/* Write the template to the work location */
ods path(prepend) work.templat(update);
/* Define a style named STYLES.COLORRAMP with the color definitions */
proc template;
define style styles.colorramp;
parent=styles.default;
/* Define a lighter and darker shade of blue for the starting and ending colors. */
style twocolorramp / startcolor=cxF3F7FE endcolor=cx6497EB;
/* When there are fewer than 3 response levels, GraphData1 and GraphData2
are used for the colors */
style graphdata1 from graphdata1 / color=cxF3F7FE;
style graphdata2 from graphdata2 / color=cx6497EB;
end;
run;
/* Reference the style using the STYLE= option in the ODS destination statement */
/* You can use:
ods listing close;
if you do not want to write to the LISTING destination */
ods listing style=styles.colorramp;
/* Create an HTML file containing the map.
The FILE= option names the html file that is created.
The PATH= option points to the location to store the html
and graph image files, make sure to reference a directory
you have write access to. The STYLE= option points to the
STYLES.COLORRAMP style that we created. */
ods html file='colorramp.html' path='.' style=styles.colorramp;
title 'Map with colors defined from a color ramp';
proc gmap data=maps.us map=maps.us;
id state;
choro state;
run;
quit;
/* Close the open ODS destination*/
ods html close;
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 TwoColorRamp style element in PROC TEMPLATE to define the starting and ending colors for a color ramp.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GMAP
|
Date Modified: | 2011-02-17 16:40:51 |
Date Created: | 2010-12-07 10:34:48 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
Microsoft® Windows® for x64 | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
Microsoft Windows XP Professional | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |
Windows Vista for x64 | 9.2 TS1M0 | |
64-bit Enabled AIX | 9.2 TS1M0 | |
64-bit Enabled HP-UX | 9.2 TS1M0 | |
64-bit Enabled Solaris | 9.2 TS1M0 | |
HP-UX IPF | 9.2 TS1M0 | |
Linux | 9.2 TS1M0 | |
Linux for x64 | 9.2 TS1M0 | |
OpenVMS on HP Integrity | 9.2 TS1M0 | |
Solaris for x64 | 9.2 TS1M0 | |