Date: Wed, 11 Oct 2006 20:48:27 -0400
Reply-To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Subject: Re: SAS/Graph -- accessing symbol color from a datastep?
Rick wrote:
> 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:
If there are several ClassB values (you listed 3), I don't know if having a
reference line for the proportion (of what?) will effectively communicate
the idea without being misinterpreted.
A stacked bar chart, or an S curve plot of the proportions might offer a
better visualization.
-------------------------------------------------------
data foo;
do classB = 15 to 24;
do classA = 1 to 20;
_n_ + 1;
y1 = classB/5 + sin ((classA+classB)/2) + ranuni(1234)/2;
y2 = log10(_n_) / ranuni(1234);
output;
end;
end;
run;
proc sql;
create table y2groupfraction as
select *
, 1 as block
, y2sum/sum(y2sum) as fraction
, 10 + (y2sum-min(y2sum))/(max(y2sum)-min(y2sum)) * 90 as
mapped_to_10_to_100
from (select classB, sum(y2) as y2sum
from foo group by classB)
order by classB
;
quit;
options orientation = landscape;
%let pdf_file = %sysfunc(pathname(WORK))\sample-%sysfunc(datetime()).pdf;
goptions reset=all ftext='Helvetica' i=join;
goptions goutmode=replace;
symbol1 v=dot;
axis1 minor=none;
ods pdf file="&pdf_file.";
ods listing close;
proc gplot data=foo;
plot y1 * classA = classB / haxis=axis1 ;
run;quit;
proc gchart data=y2groupfraction;
vbar block / sumvar=fraction subgroup=classB;
run;
pie classB / discrete sumvar=fraction;
run;
data cusum;
retain cusum 0;
set y2groupfraction;
output;
cusum + fraction;
output;
run;
proc gplot data=cusum;
plot cusum * classB = classB;
label cusum = 'Cumulative Y2 SUM proportion';
run;
ods pdf close;
options noxwait noxsync xmin;
x start "Default Viewer" "&pdf_file.";
-------------------------------------------------------
Richard A. DeVenezia
http://www.devenezia.com/