/****************************************************************************

* Program/Macro: Figure10_DistributionALTTimeTreat

* Lang/Vers: SAS V9.2

* Author: SAS Institute

* Date: 02/04/2012

* Program Title: Figure10_DistributionALTTimeTreat

* Description:

* This code and figure were created based upon code and output created by the SAS Institute on

* the website 'http://support.sas.com/kb/39/080.html'.

* The code and output for the SAS graphic are available at the above website.

* Edit Log: 4Feb2012 - First version complete

****************************************************************************/

options missing=' ';

/*Input dummy data for the graphic*/

data asat;

input week laba labb count1a count1b tota totb stat $ valuea valueb;

datalines;

0 1 2 0 0 221 429 MIN .25 .20

0 ...... Q1 .30 .32

0 ...... MEDIAN .35 .37

0 ...... Q3 .40 .42

0 ...... MAX .6 .63

0 ...... OUTLIER .8 .16

0 ...... OUTLIER .85 .9

0 ...... OUTLIER .9 1.1

0 ...... OUTLIER 1.4 1.55

0 ...... OUTLIER .85 1.52

0 ...... OUTLIER . 1.2

1 ...... Q1 . .

2 1 2 0 0 210 371 MIN .25 .19

2 ...... Q1 .31 .33

2 ...... MEDIAN .36 .37

2 ...... Q3 .41 .43

2 ...... MAX .60 .65

2 ...... OUTLIER .61 .75

2 ...... OUTLIER .7 .8

2 ...... OUTLIER .8 .85

2 ...... OUTLIER .61 .9

2 ...... OUTLIER 1.1 .95

2 ...... OUTLIER 1.2 1.0

2 ...... OUTLIER . 1.3

2 ...... OUTLIER . 1.4

3 ...... Q1 . .

4 1 2 1 0 199 365 MIN .17 .16

4 ...... Q1 .36 .33

4 ...... MEDIAN .40 .39

4 ...... Q3 .43 .44

4 ...... MAX .61 .64

4 ...... OUTLIER .7 .7

4 ...... OUTLIER .75 .8

4 ...... OUTLIER .8 .9

4 ...... OUTLIER .85 1.1

4 ...... OUTLIER . 1.3

4 ...... OUTLIER . 1.35

5 ...... Q1 . .

6 ...... Q1 . .

7 ...... Q1 . .

8 1 2 2 0 195 344 MIN .23 .22

8 ...... Q1 .38 .35

8 ...... MEDIAN .41 .39

8 ...... Q3 .45 .43

8 ...... MAX .60 .62

8 ...... OUTLIER .7 .8

8 ...... OUTLIER .8 .85

8 ...... OUTLIER .9 .9

8 ...... OUTLIER 1.0 1.2

8 ...... OUTLIER . 1.25

8 ...... OUTLIER . 1.7

8 ...... OUTLIER . 1.75

9 ...... Q1 . .

10 ...... Q1 . .

11 ...... Q1 . .

12 1 2 3 0 188 325 MIN .29 .26

12 ...... Q1 .35 .34

12 ...... MEDIAN .42 .40

12 ...... Q3 .45 .46

12 ...... MAX .61 .63

12 ...... OUTLIER .7 .7

12 ...... OUTLIER .8 .725

12 ...... OUTLIER 1.1 .75

12 ...... OUTLIER . .775

12 ...... OUTLIER . .8

12 ...... OUTLIER . 1.0

12 ...... OUTLIER . 1.05

12 ...... OUTLIER . 1.20

12 ...... OUTLIER . 1.25

12 ...... OUTLIER . 1.30

12 ...... OUTLIER . 1.35

13 ...... Q1 . .

14 ...... Q1 . .

15 ...... Q1 . .

16 ...... Q1 . .

17 ...... Q1 . .

18 ...... Q1 . .

19 ...... Q1 . .

20 ...... Q1 . .

21 ...... Q1 . .

22 ...... Q1 . .

23 ...... Q1 . .

24 1 2 1 0 160 295 MIN .3 .29

24 ...... Q1 .36 .35

24 ...... MEDIAN .43 .42

24 ...... Q3 .46 .46

24 ...... MAX .60 .61

24 ...... OUTLIER .7 .9

24 ...... OUTLIER .8 1.3

24 ...... OUTLIER 1.0 1.9

25 ...... Q1 . .

26 1 2 4 0 222 431 MIN .3 .33

26 ...... Q1 .36 .37

26 ...... MEDIAN .44 .43

26 ...... Q3 .47 .48

26 ...... MAX .63 .62

26 ...... OUTLIER .7 .7

26 ...... OUTLIER .8 .8

26 ...... OUTLIER .9 .9

26 ...... OUTLIER 1.0 1.0

26 ...... OUTLIER .8 1.1

26 ...... OUTLIER .9 1.2

26 ...... OUTLIER 1.4 1.3

26 ...... OUTLIER . 1.4

26 ...... OUTLIER . 1.45

26 ...... OUTLIER . 1.5

26 ...... OUTLIER . 1.8

26 ...... OUTLIER . 1.85

;

run;

/*Add labels for >2xULN, counta and countb. Also add a week2 variable which will offset

the 2 boxplots on the graph*/

data asat;

format counta countb $char1.;

set asat;

if laba=1 then labela=">2 (A)";

if labb=2 then labelb=">2 (B)";

counta=count1a;

countb=count1b;

week2=week+.05;

run;

/*Create the template for the graph. Note the custom spacing for the tick display list*/

proc template;

define statgraph dist;

begingraph / designwidth=8in designheight=4.5in;

entrytitle 'Distribution of Alanine Aminotransferase (ALT) by Time

and Treatment';

entryfootnote halign=left'ULN - Upper Limit of

Normal'/textattrs=(size=8);

layout lattice / columns=1

columndatarange=union rowweights=(0.1 0.9) rowgutter=1px;

layout overlay / xaxisopts=(type=discrete display=none)

yaxisopts=(label=' ');

scatterplot x=week2 y=labelb /

/*discreteoffset= 0.2*/ markercharacter=countb

markercharacterattrs=graphdata2(size=9

weight=bold);

scatterplot x=week y=labela /

/*discreteoffset=-0.2*/ markercharacter=counta

markercharacterattrs=graphdata1(size=9

weight=bold);

endlayout;

layout overlay / yaxisopts=(label='ALT ( /ULN)')

yaxisopts=(linearopts=(tickvaluelist=(0.5 1.0

1.5 2.0)) offsetmin=0)

xaxisopts = (label="Week" discreteopts=(

tickdisplaylist=( "0" " " " " " " "2" " " " " " " "4" " " " " " " " " " " " " " " "8" " " " " " " " " " " " " " " "12"

" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "24" " "" " " " "Max")

tickvaluefitpolicy=stagger)

display=(tickvalues label));

boxplotparm x=week y=valuea stat=stat / legendlabel="Drug A

(ooo)" name="Drug A"

/*discreteoffset=-0.2*/ boxwidth=0.6

capshape=bracket

display=(outliers median)

medianattrs=graphdata1

whiskerattrs=graphdata1(thickness=1.5)

outlierattrs=graphdata1(size=8 weight=normal)

outlineattrs=graphdata1(thickness=1.5) ;

boxplotparm x=week2 y=valueb stat=stat / legendlabel="Drug B

(+++)" name="Drug B"

/*discreteoffset=0.2*/ boxwidth=0.6

capshape=bracket

display=(outliers median)

medianattrs=graphdata2(pattern=solid)

outlineattrs=graphdata2(pattern=solid

thickness=1.5)

whiskerattrs=graphdata2(pattern=solid

thickness=1.5)

outlierattrs=graphdata2(size=8 weight=normal

symbol=plus);

referenceline y=1.0 / lineattrs=(pattern=shortdash);

referenceline x=25 / lineattrs=(pattern=solid);

referenceline y=2.0 / lineattrs=(pattern=solid);

referenceline y=0 / lineattrs=(pattern=solid);

innermargin;

blockplot x=week2 block=totb /

label="Drug B" display=(label values)

valuehalign=start

repeatedvalues=true filltype=Alternate

valueattrs=graphdatatext(color=graphdata2:contrastcolor)

labelattrs=graphvaluetext(color=graphdata2:contrastcolor);

blockplot x=week block=tota /

label="Drug A" display=(label values)

valuehalign=start

repeatedvalues=true filltype=Alternate

valueattrs=graphdatatext(color=graphdata1:contrastcolor)

labelattrs=graphvaluetext(color=graphdata1:contrastcolor);

endinnermargin;

endlayout;

sidebar / align=bottom spacefill=false;

discretelegend "Drug A" "Drug B";

endsidebar;

endlayout;

endgraph;

end;

run;

ods listing close;

ods html image_dpi=100 file='alt.html' path='.';

ods graphics / reset noborder width=700px height=400px

imagename="ClinicalHandout_ALT" imagefmt=gif noscale;

proc sgrender data=asat template=dist;

run;

ods html close;

ods listing;

goptions reset=all;