Sample 24925: Order the legend entries using the ORDER= option on a LEGEND statement with PROC GPLOT
This sample uses the ORDER= option on a LEGEND statement with PROC GPLOT to order the values that appear in the legend.
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 ORDER= option on a LEGEND statement with PROC GPLOT to order the values that appear in the legend.
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 the data set */
data one;
input State $2. Sales Region $;
datalines;
CA 9 West
VA 5 South
OR 9 West
NC 5 South
NY 7 North
PA 3 East
NJ 7 North
MD 3 East
;
run;
/* Use ORDER= on a LEGEND statement to reorder */
/* the legend entries. */
legend1 order=('West' 'South' 'North' 'East')
label=none down=2;
symbol1 font=marker v=C c=vibg i=none h=1.3;
symbol2 font=marker v=S c=depk i=none h=1.3;
symbol3 font=marker v=A c=grp i=none h=1.3;
symbol4 v=dot c=mob i=none h=1.5;
axis1 minor=none offset=(4pct,4pct);
axis2 minor=none offset=(4pct,4pct);
title1 'Using the ORDER option on a LEGEND statement';
/* Create the graph */
proc gplot data=one;
plot sales*state=region / legend=legend1
haxis=axis1 vaxis=axis2;
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 ORDER= option on a LEGEND statement with PROC GPLOT to order the values that appear in the legend.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GPLOT Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Legends
|
| Date Modified: | 2005-08-31 03:03:18 |
| Date Created: | 2004-11-11 11:08:01 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |