Hello Eveyone,
=A0
I am trying to create a stacked bar grpah with subpercents. The graph lists=
the number of chemotherapy cycles patients received by whether or not they=
have completed treatment. There are 32=A0patients, 16 of whom have complet=
ed treatment and 16 of whom have not.
=A0
My code is pasted below.=20
=A0
I would like to get the overall percents at the top of each bar (i.e., in t=
he outside =3D position) and the subpercents=A0within the segments of each =
bar (i.e., in the inside=3D position).=A0For example,=A0I have a total of 6=
patients who have undergone=A02 cycles of treatment. Four patients have co=
mpleted treatment and two patients are still on treatment. Thus, the overal=
l percent for this bar should be 18.75% (6/32) and the two inside percents =
should be 12.5% (2/16)=A0and 25.0% (4/16)=A0respectively.=20
=A0
Getting the outside percent to display correctly is no problem but=A0gettin=
g the inside percents is proving to be much more difficult.
=A0
Can anyone show me how to get the inside percents?
=A0
A couple of additional questions arose as I was trying to figure out how to=
make this graph.
The first concerns how to draw an appropriately sized box around the legend=
.=A0In my code, I can use /*cborder=3Dblack*/ to=A0draw a box. However, the=
box is far too wide and, in the end, I wound up using an annotate dataset =
to draw the box.=20
=A0
Is there a way to control the size of the box around the legend without res=
orting to the use of an annotate dataset?
=A0
Finally, I also had the idea of just drawing the percent values on the bars=
using something like:
=A0
note height =3D 0.75 j =3D left
move =3D (10, 15) "(12.50%)";
=A0
The problem is that SAS puts the text behinnd the bars instead of in front =
so that they cannot be seen. I looked but was unable to find a command that=
would enable me to bring the text to the foreground.
=A0
Can anyone show me how to do this?
=A0
Thanks foy your help.
=A0
Paul=A0
=A0
=A0
**** Create vertical bar graph;
**** Define graphics options;
goptions reset =3D all;
goptions device =3D Cgmof97l gsfname =3D wordfile ftext=3D htext=3D1;
filename wordfile "N:\Studies\MBC 0606\Output\Cycles Received.cgm";
=A0
**** List Title;
title h =3D 2 "Number of Cycles Received by Patients (N=3D&pt)";
**** Define horizontal axis options;
axis1 label =3D (h =3D 1.5 "Cycles") /*order =3D (1 to 16 by 1)*/ minor =3D=
none;
=A0
**** Define vertical axis options;
axis2 label =3D (h =3D 1.5 a =3D 90 "Frequency") order =3D (0 to 7 by 1) mi=
nor =3D none;
pattern1 color=3Dvlib; /* very-light-blue*/
pattern2 color=3Dpalg; /* pale-light-green*/
legend1 across=3D2 shape=3Dbar(2,1)
label=3D(h=3D1 "Completed Treatment" position=3D(top center))
/*cborder=3Dblack*/ position=3D(top inside right)
offset=3D(0,-3) /*mode=3Dprotect value=3D(h=3D0.90)*/ order=3D(" Yes" "No")=
;
=A0
data anote;=20
function =3D'move'; x=3D59; y=3D44; output;
function =3D'draw'; x=3D80; y=3D44; size=3D1;line=3D1;color=3D'black'; outp=
ut;
function =3D'draw'; x=3D80; y=3D38; size=3D1;line=3D1;color=3D'black'; outp=
ut;
function =3D'draw'; x=3D59; y=3D38; size=3D1;line=3D1;color=3D'black'; outp=
ut;
function =3D'draw'; x=3D59; y=3D44; size=3D1;line=3D1;color=3D'black'; outp=
ut;
run;
=A0
proc gchart data=3Dcycles annotate=3Danote;
vbar cycles /
discrete
width =3D 6
subgroup =3D off_treatment
maxis =3D axis1
raxis =3D axis2
/*outside=3Dfreq
inside=3Dfreq*/
legend=3Dlegend1;
=A0
footnote1 "Note: Results are based on &pt subjects.";
footnote2 h=3D2;
=A0
note height =3D 0.75 j =3D left
move =3D (10, 15) "(12.50%)";
run;
quit;
goptions reset =3D all;
=A0
=A0
=A0=0A=0A=0A _________________________________________________________=
_________=0ALooking for the perfect gift? Give the gift of Flickr! =0A=0Aht=
tp://www.flickr.com/gift/