This sample uses the Graph Template Language (GTL) to produce a graph that shows drug distribution by time and treatment.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
options missing=' ';
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 1 2 0 0 216 389 MIN .25 .26
1 . . . . . . Q1 .30 .30
1 . . . . . . MEDIAN .35 .35
1 . . . . . . Q3 .40 .42
1 . . . . . . MAX .65 .58
1 . . . . . . OUTLIER .8 .8
1 . . . . . . OUTLIER .85 .85
1 . . . . . . OUTLIER . .875
1 . . . . . . OUTLIER . .9
1 . . . . . . OUTLIER 1.2 .925
1 . . . . . . OUTLIER 1.4 1.6
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;
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;
run;
proc template;
define statgraph dist;
begingraph / designwidth=7in designheight=4.5in;
entrytitle 'Distribution of ASAT by Time and Treatment';
layout lattice / columns=1
columndatarange=union rowweights=(0.1 0.9) rowgutter=1px;
layout overlay / xaxisopts=(type=discrete display=none)
yaxisopts=(label=' ');
scatterplot x=week 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='ASAT (/ULN)')
yaxisopts=(linearopts=(tickvaluelist=(0.5 1.0 1.5 2.0)) offsetmin=0)
xaxisopts = (label="Week" discreteopts=(
tickdisplaylist=("0" "1" "2" " " "4" " " " " " " "8" " " " " " " "12"
" " " " " " " " " " " " " " " " " " " " " " "24" " " "Max"))
display=(tickvalues label));
boxplotparm x=week y=valuea stat=stat / name="Drug A"
discreteoffset=-0.2 boxwidth=0.25 capshape=bracket
display=(outliers median)
medianattrs=graphdata1
whiskerattrs=graphdata1(thickness=2)
outlierattrs=graphdata1(size=8 weight=bold)
outlineattrs=graphdata1(thickness=2) ;
boxplotparm x=week y=valueb stat=stat / name="Drug B"
discreteoffset=0.2 boxwidth=0.25 capshape=bracket
display=(outliers median)
medianattrs=graphdata2(pattern=solid)
whiskerattrs=graphdata2(pattern=solid thickness=2)
outlineattrs=graphdata2(pattern=solid thickness=2)
outlierattrs=graphdata2(size=8 weight=bold symbol=triangle);
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=week 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='asat.html' path='.';
ods graphics / reset noborder width=600px height=400px
imagename="ClinicalHandout_ASAT" imagefmt=gif noscale;
proc sgrender data=asat template=dist;
run;
ods html close;
ods listing;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGRENDER Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Template Language (GTL) Query and Reporting ==> Creating Reports ==> Graphical ==> Health and Life Sciences Industry |
Date Modified: | 2010-06-07 16:59:14 |
Date Created: | 2010-03-19 09:05:04 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | z/OS | 9.2 TS2M3 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M3 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M3 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M3 | |||
Microsoft Windows XP 64-bit Edition | 9.2 TS2M3 | |||
Microsoft® Windows® for x64 | 9.2 TS2M3 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M3 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M3 | |||
Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M3 | |||
Microsoft Windows Server 2008 | 9.2 TS2M3 | |||
Microsoft Windows XP Professional | 9.2 TS2M3 | |||
Windows 7 Enterprise 32 bit | 9.2 TS2M3 | |||
Windows 7 Enterprise x64 | 9.2 TS2M3 | |||
Windows 7 Home Premium 32 bit | 9.2 TS2M3 | |||
Windows 7 Home Premium x64 | 9.2 TS2M3 | |||
Windows 7 Professional 32 bit | 9.2 TS2M3 | |||
Windows 7 Professional x64 | 9.2 TS2M3 | |||
Windows 7 Ultimate 32 bit | 9.2 TS2M3 | |||
Windows 7 Ultimate x64 | 9.2 TS2M3 | |||
Windows Vista | 9.2 TS2M3 | |||
64-bit Enabled AIX | 9.2 TS2M3 | |||
64-bit Enabled HP-UX | 9.2 TS2M3 | |||
64-bit Enabled Solaris | 9.2 TS2M3 | |||
HP-UX IPF | 9.2 TS2M3 | |||
Linux | 9.2 TS2M3 | |||
Linux for x64 | 9.2 TS2M3 | |||
OpenVMS on HP Integrity | 9.2 TS2M3 | |||
Solaris for x64 | 9.2 TS2M3 |