Using PROC SGPLOT for Quick High Quality Graphs

32
Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Lora Delwiche Susan Slaughter Using PROC SGPLOT Using PROC SGPLOT for Quick High Quality Graphs for Quick High Quality Graphs

description

Using PROC SGPLOT for Quick High Quality Graphs. Lora Delwiche Susan Slaughter. ODS Graphics. New with SAS 9.2 Phase 1 Need SAS/GRAPH Statistical procedures now produce graphics New procedures just for graphing SGPLOT SGSCATTER SGPANEL SGRENDER. SGPLOT. 15 types of graphs - PowerPoint PPT Presentation

Transcript of Using PROC SGPLOT for Quick High Quality Graphs

Page 1: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Lora DelwicheSusan Slaughter

Using PROC SGPLOT Using PROC SGPLOT for Quick High Quality Graphsfor Quick High Quality Graphs

Page 2: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

ODS Graphics

New with SAS 9.2 Phase 1

Need SAS/GRAPH

Statistical procedures now produce graphics

New procedures just for graphing• SGPLOT

• SGSCATTER

• SGPANEL

• SGRENDER

Page 3: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

SGPLOT

15 types of graphs

Simple statements

Can combine graphs

Results in standard image file formats

View graphs in standard viewers

Use ODS styles and destinations

Page 4: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

SCATTER

Page 5: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

SERIES

Page 6: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

STEP

Page 7: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

NEEDLE

Page 8: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

BAND

Page 9: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

REG

Page 10: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

LOESS

Page 11: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

PBSPLINE

Page 12: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

HBOX and VBOX

Page 13: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

HISTOGRAM

Page 14: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

DENSITY

Page 15: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

HISTOGRAM with DENSITY

Page 16: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

ELLIPSE with SCATTER

Page 17: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

HBAR and VBAR

Page 18: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

HLINE and VLINE

Page 19: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

VBAR withVLINE

Page 20: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

DOT

Page 21: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Does everyone have the handout?

Step-by-step instructions

Tables of selected SGPLOT statements

The workshop materials can be found at

http://support.sas.com/events/sasglobalforum/2009/handson 

Page 22: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Controlling plot structure

Most plot types • Can add grouping variable

Some plot types have additional options• HISTOGRAM and DENSITY

− Scale for axis (percent, count, or proportion)

• VBAR and HBAR

− Numeric response variable

Page 23: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Controlling graph appearance

LABEL statement

User-defined formats

General SGPLOT options• Legend labels

• Transparency settings

• Displaying markers (or not)

Page 24: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Controlling graph appearance

Options specific to plot type• REG

− Display confidence limits

• SCATTER

− Label data points

• NEEDLE

− Baseline value

Page 25: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Optional Statements

Reference lines• X or Y axis

• Can add labels

Axis attributes• Labels

• Type (Discrete, Linear, Log or Time)

• Values for tics

• Grid

Insets

Page 26: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Attributes

Markers• Symbol

• Color

• Size

Lines• Pattern

• Color

• Thickness

Fill• Color

Page 27: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

ODS Destinations

Uses standard ODS destinations• LISTING

• HTML

• PDF

• RTF

Page 28: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

ODS Styles

For LISTING destination styles apply to graphs only

Can use any style for example:• ANALYSIS Color

• STATISTICAL Color

• JOURNAL Gray Scale

• JOURNAL2 Black and White

Page 29: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

ODS Graphics Editor

Make changes to existing graphs

LISTING destination must be open

SGEDIT ON

SGEDIT OFF

Additional methods in SAS 9.2 Phase 2

Page 30: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

SGPANEL

Most statements same as SGPLOT

Just add PANELBY statement

Produces separate plot for each value of PANELBY variable

Page 31: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Recommended paper

Secrets of the SG Procedures

by Dan Heath, SGF 2009

Find any SAS conference paper at

www.lexjansen.com

Page 32: Using PROC SGPLOT  for Quick High Quality Graphs

Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Any Questions?

 

The Little SAS Book: A Primer

Fourth Edition

Lora Delwiche Susan [email protected] [email protected]

(530) 752-9321 www.avocetsolutions.com