/* Schematic plot to show hypotheses for noninferiority, superiority, and equivalence tests. */ proc format; value yf 1="Equivalence" 3.5="Superiority" 6.5="Noninferiority"; value xf 3=' ' 5=' ' 7=' '; run; data a; length lcap hcap $ 11; input g y l lcap $ h hcap $; id=_n_; if id in (1,5) then hlab="Better"; if id in (4,8) then llab="Better"; format y yf. h xf.; datalines; 2 7 3 none 9 filledarrow 1 7 1 filledarrow 3 none 1 6 7 none 9 filledarrow 2 6 1 filledarrow 7 none 2 4 7 none 9 filledarrow 1 4 1 filledarrow 7 none 1 3 3 none 9 filledarrow 2 3 1 filledarrow 3 none 1 1 7 none 9 filledarrow 2 1 3 none 7 none 1 1 1 filledarrow 3 none ; data H0H1; set a; length drawspace $ 13 label $ 24; drawspace="datavalue"; function="text"; textweight="bold"; textsize=12; y1=y; textcolor="black"; if g=1 then label="H(*ESC*){sub '0'}"; else label="H(*ESC*){sub '1'}"; if lcap="filledarrow" then x1=2; else if hcap="filledarrow" then x1=8; else x1=5.3; keep drawspace function x1 y1 label textcolor textweight textsize; run; data Xticks; drawspace="graphpercent"; x1space="datavalue"; function="text"; textweight="bold"; textsize=12; textcolor="black"; y1=3; width=25; x1=3; label="p(*ESC*){sub '0'}-margin"; output; x1=5; label="p(*ESC*){sub '0'}"; output; x1=7; label="p(*ESC*){sub '0'}+margin"; output; run; data anno; set H0H1 Xticks; run; ods graphics / noborder; proc sgplot data=a noautolegend sganno=anno; highlow y=y high=h low=l / type=bar group=g highcap=hcap lowcap=lcap lowlabel=llab highlabel=hlab labelattrs=(size=14 pt); refline 3 5 7 / axis=x label=("" "" "") lineattrs=(thickness=3 px color=black); yaxis display=(nolabel noticks noline) values=(1 3.5 6.5) valueattrs=(size=14 pt) offsetmax=0.15; xaxis display=(nolabel noline noticks) values=(3 5 7) valueshint; run;