Modifying Graphics in SAS

Similar documents
IMPROVING A GRAPH USING PROC GPLOT AND THE GOPTIONS STATEMENT

Tips to Customize SAS/GRAPH... for Reluctant Beginners et al. Claudine Lougee, Dualenic, LLC, Glen Allen, VA

Chapter 13 Introduction to Graphics Using SAS/GRAPH (Self-Study)

CHAPTER 1 Introduction to SAS/GRAPH Software

The Plot Thickens from PLOT to GPLOT

SAS: Proc GPLOT. Computing for Research I. 01/26/2011 N. Baker

Want Quick Results? An Introduction to SAS/GRAPH Software. Arthur L. Carpenter California Occidental Consultants

SAS/GRAPH Introduction. Winfried Jakob, SAS Administrator Canadian Institute for Health Information

Arthur L. Carpenter California Occidental Consultants

SAS Graph: Introduction to the World of Boxplots Brian Spruell, Constella Group LLC, Durham, NC

Chapter 1 Introduction. Chapter Contents

The GIMPORT Procedure

PharmaSUG 2012 Paper CC13

Picturing Statistics Diana Suhr, University of Northern Colorado

Effective Forecast Visualization With SAS/GRAPH Samuel T. Croker, Lexington, SC

Top Award and First Place Best Presentation of Data Lan Tran-La. Scios Nova, Inc. BLOOD PRESSURE AND HEART RATE vs TIME

Making Presentations More Fun with DATA Step Graphics Interface (DSGI) Hui-Ping Chen, Eli Lilly and Company, Indianapolis, Indiana

Controlling Titles. Purpose: This chapter demonstrates how to control various characteristics of the titles in your graphs.

TS-659: Exporting SAS/GRAPH Output to PDF Files from Release 8.2 and higher

Introduction to SAS/GRAPH Statistical Graphics Procedures

ODS The output delivery system

The GTESTIT Procedure

The GANNO Procedure. Overview CHAPTER 12

Graphics - Part III: Basic Graphics Continued

1182 Index. batch mode 28 BCOLOR= option TITLE, FOOTNOTE, and NOTE statements

Interactive Graphs from the SAS System

Tips for Producing Customized Graphs with SAS/GRAPH Software. Perry Watts, Fox Chase Cancer Center, Philadelphia, PA

A Plot & a Table per Page Times Hundreds in a Single PDF file

A SAS Macro to Generate Caterpillar Plots. Guochen Song, i3 Statprobe, Cary, NC

Tips and Tricks in Creating Graphs Using PROC GPLOT

New Visualization in V8.2

ABSTRACT. The SAS/Graph Scatterplot Object. Introduction

SAS Graphs in Small Multiples Andrea Wainwright-Zimmerman, Capital One, Richmond, VA

Publication-quality figures with Inkscape

Visual Styles for V9 SAS Output Jeff Cartier, SAS Institute Inc., Cary, NC

Using MACRO and SAS/GRAPH to Efficiently Assess Distributions. Paul Walker, Capital One

ABC s of Graphs in Version 8 Caroline Bahler, Meridian Software, Inc.

Coders' Corner. Paper ABSTRACT GLOBAL STATEMENTS INTRODUCTION

SAS/GRAPH : Using the Annotate Facility

It s Not All Relative: SAS/Graph Annotate Coordinate Systems

INTRODUCTION TO THE SAS ANNOTATE FACILITY

III-6Exporting Graphics (Windows)

Presentation Quality Graphics with SAS/GRAPH

What's New in Release of SAS/GRAPH Software

Handout 4 - Interpolation Examples

SAS/GRAPH 9.4: Java Applets and ActiveX Control User s Guide

Using SAS/GRAPH Software to Create Graphs on the Web Himesh Patel, SAS Institute Inc., Cary, NC Revised by David Caira, SAS Institute Inc.

Using SAS/GRAPH Software to Create Graphs on The Web Himesh Patel, SAS Institute Inc., Cary, NC

Applications Development. Paper 24-27

BiplotGUI. Features Manual. Anthony la Grange Department of Genetics Stellenbosch University South Africa. Version February 2010.

USING GOPTION STATEMENTS FOR PC/SAS GRAPHIC DEVICES. Randy Van Beek South Dakota State University Computing Center

A Juxtaposition of Tables and Graphs Using SAS /GRAPH Procedures

Data Driven Annotations: An Introduction to SAS/GRAPH s Annotate Facility

The G3GRID Procedure. Overview CHAPTER 30

Trend Reporting Using the MXG Trend Performance Database

Innovative Graph for Comparing Central Tendencies and Spread at a Glance

Lecture 8. Divided Differences,Least-Squares Approximations. Ceng375 Numerical Computations at December 9, 2010

Chapter 3: Rate Laws Excel Tutorial on Fitting logarithmic data

Chapter 1 Introduction. Chapter Contents

Chapter 12: Quadratic and Cubic Graphs

Something for Nothing! Converting Plots from SAS/GRAPH to ODS Graphics

Input/Output Machines

Applied Regression Modeling: A Business Approach

Information Visualization

USING SAS PROC GREPLAY WITH ANNOTATE DATA SETS FOR EFFECTIVE MULTI-PANEL GRAPHICS Walter T. Morgan, R. J. Reynolds Tobacco Company ABSTRACT

Chapter 5 Accumulating Change: Limits of Sums and the Definite Integral

Creating a Basic Chart in Excel 2007

SparkLines Using SAS and JMP

Sketching graphs of polynomials

Spreadsheet and Graphing Exercise Biology 210 Introduction to Research

Objectives: Find a function that models a problem and apply the techniques from 4.1, 4.2, and 4.3 the find the optimal or best value.

Matlab Plots in Microsoft Word

Chapter 5snow year.notebook March 15, 2018

Is your picture worth a thousand words? Creating Effective Presentations with SAS/GRAPH

Where we are. HOW do we apply the concepts of quadratics to better understand higher order polynomials?


A Generalized Procedure to Create SAS /Graph Error Bar Plots

Chemistry 1A Graphing Tutorial CSUS Department of Chemistry

An alternative view.

Semester 2 Review Problems will be sectioned by chapters. The chapters will be in the order by which we covered them.

ODS LAYOUT is Like an Onion

Introduction to Statistical Graphics Procedures

Paper Abstract. Introduction. SAS Version 7/8 Web Tools. Using ODS to Create HTML Formatted Output. Background

For proceedings contributors: general submission procedures and formatting guidelines for L A TEX2E users

Contents of SAS Programming Techniques

Microsoft Excel 2007

Submission Guideline Checklist

Getting Started. What is SAS/SPECTRAVIEW Software? CHAPTER 1

Unit: Quadratic Functions

ODS and Web Enabled Device Drivers: Displaying and Controlling Large Numbers of Graphs. Arthur L. Carpenter and Richard O. Smith Data Explorations

Bi 1x Spring 2014: Plotting and linear regression

Introduction to IgorPro

Exporting SAS/GRAPH to Other Packages What Format Should I Choose? (Version 6 of the SAS System)

f( x ), or a solution to the equation f( x) 0. You are already familiar with ways of solving

run ld50 /* Plot the onserved proportions and the fitted curve */ DATA SETR1 SET SETR1 PROB=X1/(X1+X2) /* Use this to create graphs in Windows */ gopt

Multiple Graphical and Tabular Reports on One Page, Multiple Ways to Do It Niraj J Pandya, CT, USA

2-9 Operations with Complex Numbers

9 POINTS TO A GOOD LINE GRAPH

Paper: PO19 ARROW Statistical Graphic System ABSTRACT INTRODUCTION pagesize=, layout=, textsize=, lines=, symbols=, outcolor=, outfile=,

Electronic Artwork Information for Authors Glossary and definitions

Transcription:

Modifying Graphics in SAS Statistics 135 Autumn 2005 Copyright c 2005 by Mark E. Irwin

Modifying Graphs As in S, it is possible to modify fonts, colours, symbols, lines, etc in SAS. The approach is a bit different, as much of these changes are done outside the PROC used for graphing. These can be controlled with the following statements (which in many cases should be placed just before the PROC they are to be applied to) AXIS: Control axes in GBARLINE, GCHART, GCONTOUR, GPLOT, and GRADAR procedures. The basic structure in AXIS<1:99> <OPTIONS> ; You must give a number when defining an axis. This also allows for an axis definition to be used in multiple plots. Modifying Graphs 1

The important options are LABEL: Axis label. Like xlab and ylab in S. ORDER: Positions of major tick marks. VALUE: Text for major tick marks. COLOR: Colour of axis. LOGBASE = base E PI: Allows for logarithmic axis scale. LOGSTYLE = EXPAND POWER: EXPAND shows actual values while POWER shows log values. Modifying Graphs 2

MAJOR: Configures major tick marks. MINOR: Configures major tick marks. Each of these options may take multiple suboptions. For example, let look at AXIS1 LABEL = ("Promotion ($1000)"); AXIS3 LABEL = (COLOR = cyan Sales justify=right (1000s of squares) ) COLOR = green MINOR = (NUMBER = 3 COLOR = red); PROC GPLOT DATA=shingles2; PLOT sales*promotion / HAXIS=axis1 VAXIS=axis3; Modifying Graphs 3

Modifying Graphs 4

LEGEND: Controls the legend in GCHART, GCONTOUR, GMAP, and GPLOT procedures. Important options include LABEL: A label for the legend VALUE: Description of each level ORDER: Order that values appear in the legend POSITION=(<BOTTOM MIDDLE TOP> <LEFT CENTER RIGHT> <INSIDE OUTSIDE>): Where to position the legend ACROSS=n Number of columns DOWN=n Number or rows Here is an example of a legend Modifying Graphs 5

LEGEND1 LABEL = ( Potential Category ) VALUE = ( Low Moderate High ) POSITION = (top left inside); PROC GPLOT DATA=shingles2; PLOT sales*promotion=pot / HAXIS=axis1 VAXIS=axis2 LEGEND = LEGEND1; Modifying Graphs 6

Modifying Graphs 7

PATTERN: Controls the use of patterns in graphs created by GCHART, GCONTOUR, GMAP, GPLOT procedures. Also used as part of the SYMBOL statement. The strucutre of the statement looks like PATTERN<1...255> <COLOR=pattern-color> <REPEAT=number-of-times> <VALUE=bar/block-pattern map/plot-pattern pie/star-pattern hardware-pattern>; For example Modifying Graphs 8

PATTERN1 COLOR=CX993366 ; PROC GCHART DATA = shingles2; TITLE Breakdown of Region Potential Classes ; VBAR potentcat / MIDPOINTS = Low Moderate High ; Modifying Graphs 9

SYMBOL: Controls symbols in GBARLINE, GCHART, GCONTOUR, GPLOT, and GRADAR procedures. The structure of the statement is SYMBOL<1...255> <COLOR=symbol-color> <MODE=EXCLUDE INCLUDE> <REPEAT=number-of-times> <STEP=distance<units>> <appearance-option(s)> <interpolation-option> <SINGULAR=n>; Important options include Modifying Graphs 10

VALUE: Indicates what symbol to use. From the documentation page Modifying Graphs 11

HEIGHT: Indicates the size of the symbol. In the default setup, it acts like a multiplier. INTERPOL: Indicates how points should be joined, if at all. Some of the possibilities include JOIN: Join points by straight lines. Like type="l" in S BOX: Box plot for each X HILO: Vertical lines between min and max Y values for each X L: Lagrangian interpolation polynomial NEEDLE: Draw vertical line from Y to 0 for each point R: Regression fits. Can handle linear (L), quadratic (Q) and cubic (C) fits. Can add confidence intervals for fits and prediction intervals. STEP: Step plot LINE: Line type. There are 46 of them Modifying Graphs 12

Here is an example of SYMBOL statements. In this example, a SYMBOL statement is needed for each level of pot, which is the reason for three of them. If there is only one level in the plot only one is needed. SYMBOL1 COLOR=blue VALUE=triangle height=1; SYMBOL2 COLOR=CXFF0000 VALUE=plus height=1.5; SYMBOL3 COLOR=green VALUE=+ height=2; PROC GPLOT DATA=shingles2; PLOT sales*promotion=pot / HAXIS=axis1 VAXIS=axis2 LEGEND = LEGEND1; Modifying Graphs 13

Modifying Graphs 14

FOOTNOTE: Adds footnotes to plots in many PROCs. Works similarly to adding footnotes to regular output. TITLE: Affects titles on plots, similarly to the use of the command in general output. Both of these take the same options. include The important ones of these COLOR: Font colour. There is a number of ways to indicate fonts. This can be done by name, RGB codes (which look like CXRRGGBB), CYMK codes, plus others as well. FONT: Type face. Check the documentation for the possibilities, which include CENTURY, SWISS, GERMAN, HERSHEY, MARKER (useful for plotting symbols). Adding B at the end of the name will bold the font, I will italize it, and BI will bold-italize it (in most cases). JUSTIFY = LEFT CENTER RIGHT: Justification of text. Like TITLEs and FOOTNOTEs in regular output, you can use number to have multiple lines. Modifying Graphs 15

GOPTIONS GOPTIONS is used to setup graphics options in SAS. These can either be global options or ones specific to a single plot. These can be used for setting fonts FTEXT, FTITLE, HTEXT, HTITLE, colour COLOR, CBACK, CBY, CPATTERN, CSYMBOL, and how output is sent to output. GOPTIONS is the SAS equivalent to par is S. One important options is RESET = ALL which does what it says. Generally, changing a setting will make it effective for all following plots, unless they are reset GOPTIONS 16

Writing Figures to Files As mentioned before, SAS graphics can be written out in many format. While some can be done by choosing Save from the File menu, often it is better to save the file with SAS code. To save your file in a specific format you need to know the appropriate device driver. This can be determined by the code proc gdevice catalog=sashelp.devices; However ones you might find useful are Writing Figures to Files 17

Device Driver Format pslepsfc Colour Encapsulated Postscript (*) psepsf Gray-scale Encapsulated Postscript (*) pscolor ps Colour Postscript Gray-scale Postscript pdf Portable Document Format (*) emf Enhanced Windows Metafile (*) wmf Windows Metafile gif Graphics Interchange Format (*) tiff TIFF The (*) ones are probably most useful. Encapsulated postscript for L A TEX, emf for Windows applications like Word, and gif for web uses. For gif files it is possible to indicate the size of the image with a more precise driver specification. To get the largest sized gif from SAS, use gif733 (I think). Writing Figures to Files 18

To store a figure via SAS code, you will need code along the lines of FILENAME file-reference file-location ; GOPTIONS DEVICE = desired device GSFNAME = file-reference GSFMODE = REPLACE APPEND Plot commands You might need some additional options, such as to specify the size of a postscript image. The GSFMODE option only will work with some graphic formats as appending pages to a file will only work with a limited number of formats. Writing Figures to Files 19

To save one the graphs used I place the following code just before the plotting code. FILENAME grafout5 "F:\SAS\salespromo2.eps"; GOPTIONS device=pslepsfc GSFNAME=grafout5 GSFMODE=REPLACE HSIZE = 7IN VSIZE = 5IN; For each file name This will create a colour, encapsulated postscript file 7 inches wide by 5 inches tall. Writing Figures to Files 20