This sample uses the Graph Template Language (GTL) to produce an overlay graph and a block plot across treatment groups.
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.
data lipid;
label a_med="Drug A" b_med="Drug B" c_med="Drug C" p_med="Placebo";
input by $ 1-7 x $ 8-17 xc a_med a_lcl a_ucl b_med b_lcl b_ucl c_med c_lcl c_ucl p_med p_lcl p_ucl;
datalines;
Test 1 Baseline 1 5.21 5.04 5.52 5.17 4.94 5.47 5.24 4.97 5.33 5.08 4.81 5.35
Test 2 Baseline 1 4.90 4.80 4.90 5.00 4.90 5.10 5.10 5.00 5.10 4.90 4.90 5.00
Test 1 Day 14 2 4.90 4.60 5.79 6.65 4.81 7.51 5.74 5.51 6.78 4.49 4.03 4.94
Test 2 Day 14 2 5.00 4.80 5.10 5.10 4.90 5.20 5.15 5.10 5.30 5.10 5.00 5.30
Test 1 Day 42 3 5.30 5.04 6.44 4.77 4.15 7.84 4.40 3.34 6.13 4.94 4.81 5.11
Test 2 Day 42 3 5.00 4.90 5.10 5.00 4.90 5.20 5.20 5.10 5.40 5.05 4.90 5.20
Test 1 Day 70 4 6.05 4.91 6.84 5.15 3.91 6.83 5.81 5.17 6.65 5.09 4.29 5.90
Test 2 Day 70 4 5.00 4.90 5.20 5.10 5.00 5.20 5.20 5.00 5.20 5.10 5.00 5.20
Test 1 Day 98 5 5.20 5.07 5.39 5.28 5.15 5.38 5.35 5.22 5.52 5.10 4.94 5.23
Test 2 Day 98 5 5.10 4.90 5.10 4.90 4.80 5.00 5.20 5.10 5.30 5.10 5.10 5.20
Test 1 End Point 6 5.24 4.97 5.48 5.15 5.09 5.42 5.34 5.15 5.53 5.04 4.94 5.22
Test 2 End Point 6 4.90 4.80 5.20 5.10 4.90 5.20 5.10 5.10 5.30 5.20 5.20 5.30
;
run;
/* Create the template for the graph*/
proc template;
define statgraph lipid_profile;
dynamic title;
begingraph / designwidth=7in designheight=4.5in;
entrytitle title;
layout lattice / columndatarange=union rowweights=(0.8 .04 .04 .04 .04 .04);
layout overlay / cycleattrs=true yaxisopts=(label='Median with 84% CI' griddisplay=on)
xaxisopts=(offsetmin=0.05 offsetmax=0.05 display=(line ticks tickvalues)
linearopts=(tickvaluelist=(1 2 3 4 5 6)
tickdisplaylist=('Baseline' 'Day 14' 'Day 42' 'Day 70' 'Day 98' 'End Point')));
scatterplot x=eval(xc-0.15) y=p_med / yerrorlower=p_lcl yerrorupper=p_ucl name='ps'
markerattrs=graphdata1(size=9px weight=bold)
errorbarattrs=graphdata1(pattern=solid thickness=2);
scatterplot x=eval(xc-0.05) y=a_med / yerrorlower=a_lcl yerrorupper=a_ucl name='as'
markerattrs=graphdata2(size=9px weight=bold)
errorbarattrs=graphdata2(pattern=solid thickness=2);
scatterplot x=eval(xc+0.05) y=b_med / yerrorlower=b_lcl yerrorupper=b_ucl name='bs'
markerattrs=graphdata3(size=9px weight=bold)
errorbarattrs=graphdata3(pattern=solid thickness=2);
scatterplot x=eval(xc+0.15) y=c_med / yerrorlower=c_lcl yerrorupper=c_ucl name='cs'
markerattrs=graphdata4(size=9px weight=bold)
errorbarattrs=graphdata4(pattern=solid thickness=2);
seriesplot x=eval(xc-0.15) y=p_med / lineattrs=graphdata1(pattern=solid thickness=2px) name='pl';
seriesplot x=eval(xc-0.05) y=a_med / lineattrs=graphdata2(pattern=shortdash thickness=2px) name='al';
seriesplot x=eval(xc+0.05) y=b_med / lineattrs=graphdata3(pattern=mediumdash thickness=2px) name='bl';
seriesplot x=eval(xc+0.15) y=c_med / lineattrs=graphdata4(pattern=dash thickness=2px) name='cl';
endlayout;
layout overlay;
entry halign=left 'Median';
endlayout;
blockplot x=xc block=c_med / display=(values label) valuehalign=center label='Drug C' repeatedvalues=true
valueattrs=graphdata4 labelattrs=graphdata4;
blockplot x=xc block=b_med / display=(values label) valuehalign=center label='Drug B' repeatedvalues=true
valueattrs=graphdata3 labelattrs=graphdata3;
blockplot x=xc block=a_med / display=(values label) valuehalign=center label='Drug A' repeatedvalues=true
valueattrs=graphdata2 labelattrs=graphdata2;
blockplot x=xc block=p_med / display=(values label) valuehalign=center label='Placebo' repeatedvalues=true
valueattrs=graphdata1 labelattrs=graphdata1;
sidebar / spacefill=false;
discretelegend 'pl' 'al' 'bl' 'cl' / title='Treatment Group: ' across=4;
endsidebar;
endlayout;
endgraph;
end;
run;
/* Create graphs using the template and data. */
ods listing close;
ods html image_dpi=100 file='LipidProfile.html' path='.';
ods graphics / reset noborder width=600px height=400px
imagename='ClinicalHandout_LipidProfile' imagefmt=gif noscale;
proc sgrender data=lipid template=lipid_profile;
where by='Test 1';
dynamic title="Median of Lipid Profile Over Time";
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-04-08 13:29:16 |
Date Created: | 2010-03-23 13:51:47 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | z/OS | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |||
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |||
Microsoft® Windows® for x64 | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |||
Microsoft Windows XP Professional | 9.2 TS1M0 | |||
Windows Vista | 9.2 TS1M0 | |||
64-bit Enabled AIX | 9.2 TS1M0 | |||
64-bit Enabled HP-UX | 9.2 TS1M0 | |||
64-bit Enabled Solaris | 9.2 TS1M0 | |||
HP-UX IPF | 9.2 TS1M0 | |||
Linux | 9.2 TS1M0 | |||
Linux for x64 | 9.2 TS1M0 | |||
OpenVMS on HP Integrity | 9.2 TS1M0 | |||
Solaris for x64 | 9.2 TS1M0 |