您将需要转置数据,以便拥有id
、group
、period
、列result
。
VBAR 状态将从
你可以使用这些VBAR
功能
group = GROUP
datalabel = result
statlabel
例子:
data have;
call streaminit(123);
do group = 'A' , 'B';
do _n_ = 1 to ifn(group='A',6,11);
id + 1;
baseline = ifn(group='A', 2125, 4400) + rand('integer', 400) - 200;
period1 = ifn(group='A', 2425, 4100) + rand('integer', 600) - 300;
period2 = ifn(group='A', 1800, 3600) + rand('integer', 500) - 250;
period3 = ifn(group='A', 1600, 2800) + rand('integer', 500) - 250;
output;
end;
end;
label
baseline = 'Basline'
period1 = '14 Day Average'
period2 = '30 Day Average'
period3 = '60 Day Average'
;
run;
proc transpose data=have
out=plotdata (
rename=(
_name_ = period
_label_ = period_label
col1 = result
))
;
by id group notsorted;
var baseline period1-period3;
label period = ' ';
label period_label = ' ';
run;
ods html file='plot.html' style=plateau;
proc sgplot data=plotdata;
vbar period_label /
response = result
stat = mean
groupdisplay = cluster
group = group
datalabel = result statlabel
;
xaxis display=(nolabel);
run;
ods html close;
图片