Date: Mon, 9 Oct 2006 09:26:41 -0400
Reply-To: Nathaniel_Wooding@DOM.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nat Wooding <Nathaniel_Wooding@DOM.COM>
Subject: Re: SAS/Graph -- accessing symbol color from a datastep?
In-Reply-To: <1160356575.896301.211360@k70g2000cwa.googlegroups.com>
Content-Type: text/plain; charset="US-ASCII"
Rick
Here's a possible approach:
1) define your color list in a macro or macro variable -- say
%macro clist; black blue red green %mend clist;
2) use this list in a goptions statement
goptions colors= ( %clist ) ;
Then, when you are setting up your annotate statements, you can scan the
contents of the macro variable and select the appropriate color.
Good luck.
Nat Wooding
Rick
<rdbisch@GMAIL.CO
M> To
Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU
Discussion" cc
<SAS-L@LISTSERV.U
GA.EDU> Subject
SAS/Graph -- accessing symbol color
from a datastep?
10/08/2006 09:16
PM
Please respond to
Rick
<rdbisch@GMAIL.CO
M>
Short: Is there a way to get the color for a symbol inside the data
set? E.g. COLOR = SymbolColor(4) would set the variable COLOR to
whichever color was assigned to symbol4. This should work even if it's
only the default color.
Long: I have a dataset of the form:
ClassA ClassB proportion
1-20 unknown levels in [0,1]
I am trying to create a line plot that shows, on the same graph
X-Axis is classA
Y-Axis is proportion
There is a seperate line for each level in classB. So the simple way
is:
PROC GPLOT;
PLOT proportion*classA = classB;
RUN;
The tricky part is that I also want a reference line for each level of
classB showing it's overall proportion (across all values of classA).
This is what I have so far:
(unimport code that calculates the overall proportion for all levels in
classB. For example, annotate before running this datastep might be:
classB overallProportion
1 0.15
2 0.45
3 0.40
)
DATA annotate;
SET annotate;
RETAIN HSYS YSYS XSYS '2';
%ANNOMAC;
%LINE(1, overallProportion, 20, overallProportion, BLACK, 1,
.1);
RUN;
The problem with this is that you can't tell which reference line goes
to which level, because they are all black! If I had a way to get the
symbol color for symbol "i", I could just replace "BLACK" in the above
example with that color, and the reference lines color would match up
with the plot.
Other Problems:
This is trying to be a macro, so I can't code assuming only a certain
number of levels for classB. It should try to be dynamic.
Thanks in advance for any help!
-----------------------------------------
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and/or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.