Sample 69813: Creating a distribution graph using the JITTER option in the SCATTERPLOT statement over a BOXPLOT
This SAS Note provides a sample of how to create a distribution graph using the JITTER option in the SCATTERPLOT statement over a BOXPLOT using the Graph Template Language, GTL, and the SGRENDER procedure.
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.
This sample code shows how to create a distribution graph using the JITTER option in the SCATTERPLOT statement over a BOXPLOT using the Graph Template Language, GTL, and PROC SGRENDER.
data heart;
set sashelp.heart(where=(ageatstart > 56));
keep sex systolic diastolic;
run;
proc template;
define statgraph heart;
dynamic _skin _trans _elem;
begingraph / designwidth=7in designheight=4.5in
datasymbols=(circlefilled);
entrytitle "Distribution of Blood Pressure by Sex for Age > 55";
entryfootnote halign=left
"This graph uses a SCATTERPLOT with the new JITTER option over a BOXPLOT";
layout lattice / columns=2 rowdatarange=union;
rowaxes;
rowaxis / display=(ticks tickvalues) offsetmax=0.1 griddisplay=on;
endrowaxes;
layout overlay / xaxisopts=(display=(tickvalues));
entry textattrs=graphlabeltext 'Systolic' / valign=top;
scatterplot x=sex y=systolic / jitter=auto markerattrs=(symbol=circlefilled size=11)
datatransparency=_trans filledoutlinedmarkers=true
markerfillattrs=_elem dataskin=_skin;
boxplot x=sex y=systolic / display=(mean median) displaystats=standard
outlineattrs=(color=black thickness=2) whiskerattrs=(color=black thickness=2)
medianattrs=(color=black thickness=2);
endlayout;
layout overlay / xaxisopts=(display=(tickvalues));
entry textattrs=graphlabeltext 'Diastolic' / valign=top;
scatterplot x=sex y=diastolic / jitter=auto markerattrs=(symbol=circlefilled size=11)
datatransparency=_trans filledoutlinedmarkers=true
markerfillattrs=_elem dataskin=_skin;
boxplot x=sex y=diastolic / display=(mean median) displaystats=standard
outlineattrs=(color=black thickness=2) whiskerattrs=(color=black thickness=2)
medianattrs=(color=black thickness=2);
endlayout;
endlayout;
endgraph;
end;
run;
/*----Create Graph-----*/
ods graphics / reset noscale width=8in height=4.5in imagename='GTL_HeartBoxJitter';
proc sgrender data=heart template=heart;
dynamic _trans=0.7 _elem='graphdata3';
run;
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.

| Date Modified: | 2023-01-18 16:17:07 |
| Date Created: | 2023-01-18 15:31:02 |
Operating System and Release Information
| SAS System | Base SAS | z/OS | 9.4 TS1M0 | |
| z/OS 64-bit | 9.4 TS1M0 | |
| Microsoft® Windows® for x64 | 9.4 TS1M0 | |
| Microsoft Windows 8 Enterprise x64 | 9.4 TS1M0 | |
| Microsoft Windows 8 Pro x64 | 9.4 TS1M0 | |
| Microsoft Windows 8.1 Enterprise 32-bit | 9.4 TS1M0 | |
| Microsoft Windows 8.1 Enterprise x64 | 9.4 TS1M0 | |
| Microsoft Windows 8.1 Pro 32-bit | 9.4 TS1M0 | |
| Microsoft Windows 8.1 Pro x64 | 9.4 TS1M0 | |
| Microsoft Windows 10 | 9.4 TS1M0 | |
| Microsoft Windows Server 2008 R2 | 9.4 TS1M0 | |
| Microsoft Windows Server 2008 for x64 | 9.4 TS1M0 | |
| Microsoft Windows Server 2012 Datacenter | 9.4 TS1M0 | |
| Microsoft Windows Server 2012 R2 Datacenter | 9.4 TS1M0 | |
| Microsoft Windows Server 2012 R2 Std | 9.4 TS1M0 | |
| Microsoft Windows Server 2012 Std | 9.4 TS1M0 | |
| Windows 7 Enterprise x64 | 9.4 TS1M0 | |
| Windows 7 Professional x64 | 9.4 TS1M0 | |
| 64-bit Enabled AIX | 9.4 TS1M0 | |
| 64-bit Enabled Solaris | 9.4 TS1M0 | |
| HP-UX IPF | 9.4 TS1M0 | |
| Linux for x64 | 9.4 TS1M0 | |
| Solaris for x64 | 9.4 TS1M0 | |