This sample uses the Graph Template Language (GTL) to produce a box plot by treatment group.
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 depress;
input visit $ stat $ base_change_grp1 base_change_grp0;
datalines;
1 MIN -1.52119 -1.30011
1 Q1 -0.23288 -0.95122
1 MEAN -0.08434 .37135
1 MEDIAN 0.01528 .47111
1 Q3 0.47412 .78123
1 MAX 0.7918 1.81566
2 MIN -1.93079 -1.76523
2 Q1 -1.10639 -1.21228
2 MEAN 0.40024 0.21123
2 MEDIAN 0.5477 0.61299
2 Q3 0.79033 1.2146
2 MAX 1.69914 2.1912
3 MIN -1.5564 -1.7123
3 Q1 -1.12325 -0.6348
3 MEAN 0.08065 0.19012
3 MEDIAN 0.21367 0.4002
3 Q3 0.43618 0.75622
3 MAX 1.84239 1.42813
4 MIN -2.4317 -1.56822
4 Q1 -1.34534 -1.04
4 MEAN -0.47393 -0.2224
4 MEDIAN -0.33409 -0.51901
4 Q3 0.30067 .802133
4 MAX 1.41937 1.6718
5 MIN -1.75574 -1.409
5 Q1 -0.52114 -0.8723
5 MEAN -0.03002 -0.34911
5 MEDIAN 0.00894 0.056
5 Q3 0.64174 0.541
5 MAX 1.05537 1.4446
6 MIN -1.75401 -1.905
6 Q1 -0.83484 -1.21544
6 MEAN -0.20839 -0.289
6 MEDIAN -0.16041 -0.3488
6 Q3 0.49219 1.2219
6 MAX 1.06368 1.41922
7 MIN -1.24543 -1.89
7 Q1 -0.42673 -1.4489
7 MEAN 0.53669 -0.535
7 MEDIAN 0.57551 -0.5891
7 Q3 1.2504 0.913
7 MAX 2.29568 1.19
8 MIN -0.62247 -1.93079
8 Q1 -0.05789 -1.10639
8 MEAN 1.21994 0.40024
8 MEDIAN 1.19906 0.5477
8 Q3 1.51107 1.19033
8 MAX 1.91174 1.69914
9 MIN -1.4192 -2.4317
9 Q1 -1.05793 -1.34534
9 MEAN 0.1738 -0.47393
9 MEDIAN 0.27946 -0.33409
9 Q3 1.1234 0.30067
9 MAX 1.83229 1.21937
;
run;
data depress;
set depress;
if visit in ("1", "2", "3") then phase="Phase 1";
else if visit in ("4", "5", "6") then phase="Phase 2";
else if visit in ("7", "8", "9") then phase="Phase 3";
run;
proc template;
define statgraph change;
begingraph / designwidth=7in designheight=4.5in;
entrytitle "Evaluating Depression After Treatment";
layout lattice / columns=1 rowgutter=5 rowweights=(0.06 0.94);
cell;
blockplot x=visit block=phase /
display=(outline fill values) filltype=alternate
fillattrs=(color=cxf2f2f2) altfillattrs=(color=cxffffff)
outlineattrs=GRAPHREFERENCE;
endcell;
cell;
layout overlay / cycleattrs=true yaxisopts=(label="Change in Depression Score since Baseline")
xaxisopts=(label="Study Visit" display=all offsetmin=0 offsetmax=0);
blockplot x=visit block=PHASE /
display=(outline fill) filltype=alternate
fillattrs=(color=cxf2f2f2) altfillattrs=(color=cxffffff)
outlineattrs=GRAPHREFERENCE;
boxplotparm x=visit y=base_change_grp1 stat=stat / name="Active Treatment"
fillattrs=(transparency=0.25) discreteoffset=-.21 boxwidth=.37;
boxplotparm x=visit y=base_change_grp0 stat=stat / name="Placebo"
fillattrs=(transparency=0.25) discreteoffset=.21 boxwidth=.37;
discretelegend "Active Treatment" "Placebo";
endlayout;
endcell;
endlayout;
endgraph;
end;
run;
ods listing close;
ods html image_dpi=100 file='depression.html' path='.';
ods graphics / reset noborder width=600px height=400px
imagename="ClinicalHandout_Depression" imagefmt=gif noscale;
proc sgrender data=depress template="change";
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: | 2020-12-08 10:25:10 |
Date Created: | 2010-03-19 11:04:07 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M3 | |||
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M3 | |||
z/OS | 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 |