I tried to modify a plot macro which was used for Stepplot and replaced Stepplot with Barchart. The bar chart are shown OK but the bottom 3 blockplots disappeared. I tried back and forth several time and still cannot figure out what is wrong.
Thanks a lot.
Yeming
Here is the data and code:
data freqout;
input window $10. order grptot1 grptot2 grptot3 grppct1 grppct2 grppct3;
datalines;
BASELINE 1 198 205 182 97.980 97.561 96.154
WEEK 6 2 5 14 12 100.000 100.000 83.333
WEEK 12 3 179 179 155 97.207 95.531 96.129
WEEK 18 4 6 7 3 100.000 100.000 66.667
WEEK 26 5 76 73 64 96.053 94.521 100.000
END POINT 6 186 190 166 96.237 96.316 98.193
run;
proc print;
run;
%let program=test01;
%let analset=Intent-to-Treat Analysis Set;
%let test01=Bar Plot of Proportion of Subjects with HbA1c < 7% over Time;
%macro BarPlot(inds=, title1=, title2=, title3=, ylabel=);
proc template;
define statgraph Gtl_Bars;
dynamic win;
mvar locate sysdate;
begingraph;
entrytitle textattrs=(weight=bold size=11 family="Times New Roman") "&title1";
entrytitle textattrs=(weight=normal size=9 family="Times New Roman") "&title2";;
entrytitle "&title3";;
entryfootnote textattrs=(weight=normal size=8 family="Times New Roman") halign=left "Created on " SYSDATE;
layout lattice / rows=5 columndatarange=union rowweights=(0.84 .04 .04 .04 .04);
layout overlay / cycleattrs=true ;
/* Stepplot is OK */
/*
stepplot x=order y=grppct1 / name='grp1';
stepplot x=order y=grppct2 / name='grp2';
stepplot x=order y=grppct3 / name='grp3';
*/
/* Barchart is not OK, bottom 3 blockplots disappeared */
barchart x=order y=grppct1 / name='grp1';
barchart x=order y=grppct2 / name='grp2';
barchart x=order y=grppct3 / name='grp3';
endlayout;
blockplot x=order block=grptot1 / display=(values label)
valuehalign=right
repeatedvalues=true
valueattrs=(color=black style=italic size=9 family="Times New Roman")
label='Dummy A'
labelattrs=(color=black style=italic size=9 family="Times New Roman");
blockplot x=order block=grptot2 / display=(values label)
valuehalign=right
repeatedvalues=true
valueattrs=(color=black style=italic size=9 family="Times New Roman")
label='Dummy B'
labelattrs=(color=black style=italic size=9 family="Times New Roman");
blockplot x=order block=grptot3 / display=(values label)
valuehalign=right
repeatedvalues=true
valueattrs=(color=black style=italic size=9 family="Times New Roman")
label='Dummy C'
labelattrs=(color=black style=italic size=9 family="Times New Roman");
layout overlay;
entry halign=center 'Weeks';
endlayout;
sidebar / spacefill=false;
discretelegend 'grp1' 'grp2' 'grp3' / border=no across=3;
endsidebar;
endlayout;
endgraph;
end;
run;
ods graphics / width=8in height=6in imagename="&program";
proc sgrender data=&inds template=Gtl_Bars;
run;
%mend;
%BarPlot(inds=freqout,
title1=&test01,
title2=&analset,
ylabel=%str(Proportion of Subjects with HbA1c < 7% )
);