%let gpath='.';
%let dpi=200;
ods html close;
ods listing gpath=&gpath image_dpi=&dpi;
/*--Make data--*/
data box;
length cat $7;
pi=constant("pi");
a=0;
do Cat='Trace0', 'Trace1', 'Trace2', 'Trace3', 'Trace4', 'Trace5', 'Trace6', 'Trace7', 'Trace8', 'Trace9',
'Trace10', 'Trace11', 'Trace12', 'Trace13', 'Trace14', 'Trace15', 'Trace16', 'Trace17', 'Trace18', 'Trace19',
'Trace20', 'Trace21', 'Trace22', 'Trace23', 'Trace24', 'Trace25', 'Trace26', 'Trace27', 'Trace28', 'Trace29';
min=1e6;
b=10*sin(6*a*pi/180)+1;
do i=1 to 10;
value=b+rannor(2);
min=min(min, value-0.75);
output;
end;
a+1;
end;
run;
proc sort data=box out=box1;
by a;
run;
/*--Keep only one non-missing min value--*/
data boxLabel;
set box1;
by a;
if last.a then;
else min=.;
run;
/*--Box Plot--*/
ods graphics / reset width=5in height=3in imagename='Box_1';
proc sgplot data=box noautolegend noborder;
vbox value / category=cat nomean nooutliers whiskerpct=0.95;
xaxis display=(nolabel noline noticks) discreteorder=data valuesrotate=vertical;
yaxis display=(nolabel noline noticks) grid integer values=(0 to 12 by 2) valueshint;
run;
/*--Box Plot Label--*/
ods graphics / reset width=5in height=3in imagename='Box_2';
proc sgplot data=boxLabel noautolegend noborder;
vbox value / category=cat nomean nooutliers whiskerpct=0.95;
text x=cat y=min text=cat / rotate=90 position=left
textattrs=(size=6 weight=bold) contributeoffsets=(ymin);
xaxis display=(nolabel novalues noticks) discreteorder=data valuesrotate=vertical
colorbands=odd colorbandsattrs=(transparency=0.8);
yaxis display=(nolabel noline noticks) grid integer values=(0 to 12 by 2) valueshint;
run;