Date: Wed, 19 Oct 2005 13:20:39 -0400
Reply-To: Zhao Yang <tonyyangsxz@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Zhao Yang <tonyyangsxz@GMAIL.COM>
Subject: Question about LEGEND
Content-Type: text/plain; charset=ISO-8859-1
Dear Listers;
I tried to use LEGEND in proc gchart, in my program there are 6 categories,
while I only want to use the first 3, since the remaining part can be
categorized into the same one, while the graph appearance requires me to do
like that. My questions are
(1) How can I just display the first 3 categories in the legend part?
(2) I want the RAXIS to be 100 to 100 by 20, like 100 80 60 ...0 20 40
...100, actually is from -100 to 100 by 20, and if I allow SAS do it, then
the automatically generated scale is not my desire. Then how can I do this.
The code is like the following:
%macro plot(var);
data plot;
set yz.compare;
if CTRLNO=3 then output;
data plot;
set plot;
ga1=(SC306_1s-SC087_6s)/7;
if SC348_1f=. then SC348_1f=ga1;
data plot;
set plot;
array old{4} SC348_1f SC349_1 SC350_1 SC351_1;
do i=1 to 4;
if old{i}<20 or old{i}>45 then old{i}=.;
end;
diff=SC348_1f-&var;
if diff=. then delete;
data plot;
set plot;
if 0<=diff<1 then perc =1;
if 1<=diff<2 then perc =2;
if diff>=2 then perc =3;
if -1<diff<0 then perc =4;
if -2<diff<=-1 then perc =5;
if diff<=-2 then perc =6;
ga_new=floor(SC348_1f);
do i=20 to 44 by 2;
if i<=ga_new<=i+1 then ga_c=i||'-'||left((i+1));
output;
end;
proc freq data=plot;
tables perc*ga_c/out=b outpct;
run;
data b;
set b;
keep perc ga_c PCT_COL;
if ga_c=" " then delete;
if perc in (4,5,6) then PCT_COL=-PCT_COL;
run;
pattern1 color=gray value=e ;
pattern2 color=blue value=l1;
pattern3 color=green value=r2;
pattern4 color=gray value=e ;
pattern5 color=blue value=l1;
pattern6 color=green value=r2;
legend1 across=1 origin=(79,29)
value=( tick=1 justify=left '0 weeks' tick=2 justify=left '1 weeks'
tick=3 justify=left '2 weeks or more' tick=4 '' tick=5 '' tick=6 '')
position=(inside top) label=(justify=left '' position=top) mode=protect;
axis2 label= ('LMP');
axis3 label=(justify=right 'Percent overestimated' justify=left 'Percent
underestimated')
value=('50' '40' '30' '20' '10' '0' '10' '20' '30' '40' '50' '60' '70' '80'
'90' '100');
proc gchart data=b;
hbar ga_c/subgroup=perc SUMVAR=PCT_COL NOSTATS SPACE=0 raxis=axis3
maxis=axis2 legend=legend1;
run;
%mend plot;
%plot(SC349_1)
Any thinking will be highly appreciated.
Best regards,
Tony