Producing High-Quality Figures Using SASGRAPH and ODS Graphics Procedures
1 SAS Can Produce High-Quality Figures....................................................1
1.1 Introduction............................................................................................1
1.2 Two Sample Figures Produced in SAS with Different Quality.......1
1.3 Bitmap and Vector Format Figures.....................................................3
1.3.1 Bitmap Format Graphics..........................................................3
1.3.2 Vector Format Graphics...........................................................4
1.4 Why Vector Format Figures?................................................................5
1.5 Publication Requirements for Art and Figure Preparation.............5
1.5.1 Taylor & Francis Group: Electronic Art Guidelines.............5
1.5.1.1 Vector Graphics Formats..........................................6
1.5.1.2 Bitmapped Graphics Formats..................................6
1.5.2 Nature: Final Artwork.............................................................6
1.5.3 Science: Preparing Your Art and Figures.............................7
1.6 SAS Can Produce High-Quality Figures to Meet Publication
Requirements..........................................................................................7
1.7 References...............................................................................................7
2 Principles of Producing High-Quality Figures in SAS...........................9
2.1 Introduction............................................................................................9
2.2 SAS/GRAPH and ODS Graphics Procedures....................................9
2.2.1 SAS/GRAPH Procedures.........................................................9
2.2.2 SAS ODS Graphics Procedures............................................. 10
2.2.3 SAS/GRAPH versus ODS Graphics Procedures................ 10
2.3 Listing Output to Save Figures from One Procedure
(PS, EPS, EMF, CGM, and so on)........................................................ 11
2.4 ODS Output to Save Figures from Several Procedures
into a Document (PDF, RTF, and so on)............................................ 12
2.5 GOPTIONS in SAS/GRAPH............................................................... 13
2.6 Software vs. Hardware Fonts............................................................. 16
2.6.1 Software Fonts......................................................................... 16
2.6.2 Hardware Fonts....................................................................... 16
2.6.3 Available Hardware Fonts for Listing Outputs.................. 17
2.6.4 Available Hardware Fonts for ODS Outputs (RTF, PDF)..... 18
2.7 Controlling Titles and Footnotes in RTF Format Figure Files....... 18
2.8 Adding Bookmarks in PDF Format Figure Files............................. 19
vi Contents
2.9 Setting Up Global Options and Macro Variables............................ 19
2.10 References.............................................................................................20
3 Line Plots......................................................................................................... 21
3.1 Introduction.......................................................................................... 21
3.2 Application Examples.......................................................................... 21
3.2.1 A Simple Line Plot with Mean IOP Values by Time..........23
3.2.2 A Line Plot with SD Bar Displayed Together
with the Mean IOP Values.....................................................23
3.2.3 Line Plots with Maximum, Average, and Minimum
Rates and Points for a 30-year Fixed-Rate Mortgage......... 24
3.3 Producing the Sample Figures...........................................................25
3.3.1 Data Structure and SAS Annotated Dataset.......................25
3.3.2 Notes to SAS Programs..........................................................25
3.3.2.1 Main Sections and Features of the
First Program...........................................................27
3.3.2.2 Main Features of the Second SAS Program........30
3.4 Summary and Discussion................................................................... 32
3.5 References.............................................................................................34
3.6 Appendix: SAS Programs for Producing the Sample Figures.......34
3.6.1 Line Plots for IOP Values.......................................................34
3.6.2 Line Plots for Mortgage Rates and Points...........................43
4 Scatter and Jittered Scatter Plots................................................................ 51
4.1 Introduction.......................................................................................... 51
4.2 Application Examples.......................................................................... 51
4.2.1 Example 1: Scatter Plots with Mean Value Displayed....... 52
4.2.2 Example 2: Scatter Plot with Mean Values
and Reduction Reference Lines............................................ 52
4.2.3 Example 3: Jittered Scatter Plots with IOP Values
Displayed Side by Side...........................................................53
4.3 Producing the Sample Figures...........................................................54
4.3.1 Data Structure and SAS Annotated Dataset.......................54
4.3.2 Notes to SAS Programs..........................................................54
4.3.2.1 Dataset Simulation..................................................56
4.3.2.2 Data Analyses and Manipulation.........................56
4.3.2.3 SAS/GRAPH Annotate Datasets........................... 57
4.3.2.4 Producing the Scatter Plots in GPLOT.................58
4.3.2.5 Producing the Scatter Plots in SGPLOT............... 59
4.3.2.6 Producing Line-Up Jittered Scatter Plot...............60
4.4 Summary and Discussion...................................................................60
4.5 References............................................................................................. 61
4.6 Appendix: SAS Programs for Producing the Sample Figures....... 62
Contents vii
5 Line-Up Jittered Scatter Plots......................................................................75
5.1 Introduction..........................................................................................75
5.2 Algorithms for Line-Up Jittered Scatter Plots..................................75
5.3 Application Examples.......................................................................... 76
5.4 Producing the Sample Figures...........................................................77
5.4.1 Data Structure and SAS Annotated Dataset.......................77
5.4.2 Notes to SAS Programs..........................................................79
5.4.2.1 Data Simulation.......................................................79
5.4.2.2 Data Analyses and Manipulation......................... 81
5.4.2.3 Producing Sample Figures Using
PROC GPLOT...........................................................82
5.4.2.4 Producing Sample Figures Using
PROC SGPLOT........................................................84
5.5 Summary and Discussion...................................................................85
5.6 References.............................................................................................86
5.7 Appendix: SAS Programs for Producing the Sample Figures.......86
11 Survival Plots............................................................................................... 195
11.1 Introduction........................................................................................ 195
11.2 Application Examples........................................................................ 195
11.3 Producing the Sample Figures......................................................... 197
11.3.1 Data Structure....................................................................... 197
11.3.2 Notes to SAS Programs........................................................ 197
11.3.2.1 Producing Survival Plots Using
the LIFETEST Procedure Directly....................... 198
11.3.2.2 Producing Survival Plots Using the SGPLOT
Procedure with the Output Dataset from
LIFETEST.................................................................. 200
11.4 Summary and Discussion................................................................. 202
x Contents
11.5 References........................................................................................... 202
11.6 Appendix: SAS Programs for Producing the Sample Figures..... 202
12 Waterfall Plots and Histograms............................................................... 207
12.1 Introduction........................................................................................ 207
12.2 Application Examples........................................................................ 207
12.2.1 Waterfall Plot: Change from Baseline in IOP
for 50 Subjects........................................................................208
12.2.2 Histogram Plot......................................................................208
12.3 Producing the Sample Figures......................................................... 210
12.3.1 Data Structure and SAS Annotated Dataset..................... 210
12.3.2 Notes to SAS Programs........................................................ 210
12.3.2.1 Main Sections of the First Program.................... 211
12.3.2.2 Main Sections of the Second Program............... 213
12.4 Summary and Discussion................................................................. 214
12.5 References........................................................................................... 214
12.6 Appendix: SAS Programs for Producing the Sample Figures..... 215
12.6.1 Waterfall Plots....................................................................... 215
12.6.2 Histograms............................................................................ 218
13 Bland-Altman Plots for Agreement Analyses.......................................223
13.1 Introduction........................................................................................223
13.2 Agreement versus Correlation.........................................................223
13.3 Application Example.........................................................................225
13.4 Producing the Sample Figures.........................................................225
13.4.1 Data Structure.......................................................................225
13.4.2 Notes to SAS Programs........................................................225
13.4.2.1 Dataset Simulation and Analyses.......................226
13.4.2.2 Producing the Sample Plots Using
the GPLOT Procedure...........................................226
13.4.2.3 Producing the Sample Plots Using
the SGPLOT Procedure........................................226
13.5 Summary and Discussion.................................................................227
13.6 References...........................................................................................227
13.7 Appendix: SAS Programs for Producing the Sample Figures.....227
14 SAS ODS Graphic Designer......................................................................233
14.1 Introduction........................................................................................233
14.2 SAS ODS Graphic Designer..............................................................233
14.2.1 The Designer GUI.................................................................233
14.2.2 The Graph Gallery................................................................234
14.3 Using the ODS Graphic Designer to Reproduce Some
Figures in the Previous Chapters....................................................234
14.3.1 Line-Up Jittered Scatter Plots..............................................236
14.3.2 Classification Box Plots........................................................238
Contents xi
14.4 Summary and Discussion................................................................. 239
14.5 References........................................................................................... 240
14.6 Appendix: SAS Programs for Producing the Datasets
and Generated by the Designer....................................................... 240
14.6.1 The Jittered Scatter Plot: Codes Producing the Dataset.... 240
14.6.2 The Jittered Scatter Plot: GTL Codes Generated
by the Designer..................................................................... 244
14.6.3 The Classification Box Plot: Codes for Producing
the Dataset............................................................................. 245
14.6.4 The Classification Box Plot: GTL Codes Generated
by the Designer..................................................................... 248
15 Producing Figures in the SAS Enterprise Guide Environment......... 249
15.1 Introduction........................................................................................ 249
15.2 Create, Run, and Save an EG Project............................................... 249
15.3 Server List........................................................................................... 252
15.4 Some Good Features and Notes for SAS EG.................................. 252
15.5 Producing Graphics Directly in SAS EG Using
the Point-and-Click Feature..............................................................253
15.6 Summary and Discussion.................................................................255
15.7 References...........................................................................................255