Sample 38062: Symbol color based on the value of a variable with PROC GPLOT
This sample uses the SYMBOL function in an Annotate data set to place symbols on a graph whose color is determined by the value of a variable.
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 SYMBOL function in an Annotate data set to place symbols on a graph whose color is determined by the value of a variable.
The graphics output in the Results tab was produced using SAS® 9.2. Submitting the sample code with releases of SAS prior to SAS 9.2 might produce different results.
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Create an annotate data set to draw symbols on the graph */
/* where the color is determined by the value of a variable. */
data anno;
length function color $8;
retain xsys ysys '2' when 'a';
set sashelp.class;
function='symbol';
x=weight;
y=height;
size=1.3;
text='dot';
/* The symbol color is determined by the value of a variable. */
if height gt 65 then color='depk';
else color='vibg';
output;
run;
title1 "Symbol Color Based on the Value of a Variable";
/* Generate the graph. */
proc gplot data=sashelp.class;
plot height*weight / haxis=axis1 vaxis=axis2
vref=65 lvref=20 cvref=grp
annotate=anno;
symbol1 interpol=none value=none color=white;
axis1 label=("Weight in pounds") offset=(2,2)pct;
axis2 label=(angle=90 "Height in inches")
order=(50 to 80 by 5) minor=(n=4);
run;
quit;
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 SYMBOL function in an Annotate data set to place symbols on a graph whose color is determined by the value of a variable.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GPLOT Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Annotation
|
Date Modified: | 2009-12-07 14:39:07 |
Date Created: | 2009-12-07 14:22:41 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9 TS M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9 TS M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9 TS M0 | |
Microsoft Windows 2000 Advanced Server | 9 TS M0 | |
Microsoft Windows 2000 Datacenter Server | 9 TS M0 | |
Microsoft Windows 2000 Server | 9 TS M0 | |
Microsoft Windows 2000 Professional | 9 TS M0 | |
Microsoft Windows NT Workstation | 9 TS M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Standard Edition | 9 TS M0 | |
Microsoft Windows XP Professional | 9 TS M0 | |
64-bit Enabled AIX | 9 TS M0 | |
64-bit Enabled HP-UX | 9 TS M0 | |
64-bit Enabled Solaris | 9 TS M0 | |
HP-UX IPF | 9 TS M0 | |
Linux | 9 TS M0 | |
OpenVMS Alpha | 9 TS M0 | |
Tru64 UNIX | 9 TS M0 | |