ODS Graphics By Example March 16, 2016 Rocio Lopez
DESTINATION AND GENERAL GRAPH OPTIONS
Set-up
STACKED, SIDE-BY-SIDE AND OVERLAID BAR PLOTS
Stacked Bar Plot (default bar plot)
Side-by-side (clustered) Bar Plot
Overlay Bar Plot 1 2 Simply call several vbar/hbar statements
Overlay Bar Plot – Offset Bars 1 1
SPAGHETTI PLOTS
Spaghetti Plot - Default
Spaghetti Plot
Spaghetti Plot – Color By Group
USING SPECIAL CHARACTERS
Use of Symbols
Inserting symbols Syntax to insert symbol (*ESC*){unicode ‘value’x} (*ESC*) is the default ODS escape character string Special character that identifies inline formatting symbol You cannot use a user-defined character (ods escapechar=‘character’) Value is the unicode (hex) value for the symbol Syntax to insert super/subscripts (*ESC*){sup ‘text’} (*ESC*){sub ‘text’}
Useful Unicode Values SymbolUnicode (hex) value ≠2260 ≤2264 ≥2265 α03B1 ±00B1 µ00B5
How To Find Unicode Values? Microsoft Word < Insert < Symbol Or look online
Using Symbols – Axis
Using Symbols – Legend
INSERTING TEXT INTO GRAPH
Text Inset
Text Inset – Multiple Rows 11 11
Adding additional text to legend – Discrete Attribute Map
Inserting text with SG Annotation 1 1 * 2 2
TWO-IN-ONE PLOTS
Adverse Event Plot … continued on next slide
Adverse Event Plot - continued
Forest Plot
CONFIDENCE BANDS
Confidence Bands
PANEL PLOT
Panel Plot – GTL
GTL Code If you want a panel of the same type of plot you can easily obtain the GTL code from SGPlot – Use SGPlot to create the plot with all the features you want – Export the GTL code – Modify and render your new graph
GTL – DYNAMIC & MACRO VARIABLES
Reusable Graph Templates – Dynamic & Macro Variables These give you the flexibility to change variable assignments or text insets without recompiling the template
Rendering Your Template
AXIS CUSTOMIZATIONS
X-Axis Customization When tick values do not fit in the axis, SAS will first attempt to split them into multiple rows. If this is not possible, then the values are rotated
X-Axis Customization – Fit Policy Other fitpolicy options are ROTATE, ROTATETHIN, SPLITALWAYS, SPLIT (only splits if labels do not fit), SPLITROTATE (default), STAGGERROTATE,STAGGE RTHIN
X-Axis Customization – Fit Policy
Y-Axis Value Alignment When tick values do not fit in the y- axis, SAS will attempt to split them. The other option is THIN By default values will be aligned to the right
Y-Axis Value Alignment – Left or Center
MARKER CUSTOMIZATION
Using Text As Markers
Using Images As Markers
Adding Hyperlinks To Your Markers Hyperlinks will only work in HTML Data tips are explanatory text that appear when you mouse-over portion of graph
ANIMATED PLOTS
Animated GIF
Loop through your plots with macro or BY statement Export the animated graph Export the individual graphs
MISCELANEOUS
Jittering
Connecting Box Plots
Bubble Plot – Size Markers According to Variable
Changing the Background Color
OTHER USEFUL EXAMPLES
Other Examples Graphically Speaking Blog – Scatter plots stacked with histograms Scatter plots stacked with histograms – Comparative histograms Comparative histograms – Butterfly plots Butterfly plots – Nested plots Nested plots – Margin plots Margin plots – Range attribute map Range attribute map
QUESTIONS?
Next Month ODS Graphics Designer and Editor
THANKS