Using PROC SGPLOT for Quick High Quality Graphs

  • Slides: 32
Download presentation
Using PROC SGPLOT for Quick High Quality Graphs Lora Delwiche Susan Slaughter Copyright ©

Using PROC SGPLOT for Quick High Quality Graphs Lora Delwiche Susan Slaughter 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 n New with SAS 9. 2 Phase 1 n Need SAS/GRAPH n

ODS Graphics n New with SAS 9. 2 Phase 1 n Need SAS/GRAPH n Statistical procedures now produce graphics n New procedures just for graphing • SGPLOT • SGSCATTER • SGPANEL • SGRENDER 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 n 15 types of graphs n Simple statements n Can combine graphs n

SGPLOT n 15 types of graphs n Simple statements n Can combine graphs n Results in standard image file formats n View graphs in standard viewers n Use ODS styles and destinations 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

SCATTER 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

SERIES 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

STEP 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

NEEDLE 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

BAND 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

REG 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

LOESS 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

PBSPLINE 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and

HBOX and VBOX 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

HISTOGRAM 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

DENSITY 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and

HISTOGRAM with DENSITY 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and

ELLIPSE with SCATTER 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and

HBAR and VBAR 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and

HLINE and VLINE 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 with. VLINE Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and

VBAR with. VLINE 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 Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other

DOT 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? n Step-by-step instructions n Tables of selected SGPLOT statements

Does everyone have the handout? n Step-by-step instructions n Tables of selected SGPLOT statements n The workshop materials can be found at http: //support. sas. com/events/sasglobalforum/2009/handson 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 n Most plot types • Can add grouping variable n

Controlling plot structure n Most plot types • Can add grouping variable n Some plot types have additional options • HISTOGRAM and DENSITY − Scale for axis (percent, count, or proportion) • VBAR and HBAR − Numeric response variable 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 n LABEL statement n User-defined formats n General SGPLOT options •

Controlling graph appearance n LABEL statement n User-defined formats n General SGPLOT options • Legend labels • Transparency settings • Displaying markers (or not) 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 n Options specific to plot type • REG − Display confidence

Controlling graph appearance n Options specific to plot type • REG − Display confidence limits • SCATTER − Label data points • NEEDLE − Baseline value 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 n Reference lines • X or Y axis • Can add labels

Optional Statements n Reference lines • X or Y axis • Can add labels n Axis attributes • Labels • Type (Discrete, Linear, Log or Time) • Values for tics • Grid n Insets 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 n Markers • Symbol • Color • Size n Lines • Pattern •

Attributes n Markers • Symbol • Color • Size n Lines • Pattern • Color • Thickness n Fill • Color 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 n Uses standard ODS destinations • LISTING • HTML • PDF •

ODS Destinations n Uses standard ODS destinations • LISTING • HTML • PDF • RTF 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 n For LISTING destination styles apply to graphs only n Can use

ODS Styles n For LISTING destination styles apply to graphs only n Can use any style for example: • ANALYSIS Color • STATISTICAL Color • JOURNAL Gray Scale • JOURNAL 2 Black and White 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 n Make changes to existing graphs n LISTING destination must be

ODS Graphics Editor n Make changes to existing graphs n LISTING destination must be open n SGEDIT ON n SGEDIT OFF n Additional methods in SAS 9. 2 Phase 2 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 n Most statements same as SGPLOT n Just add PANELBY statement n Produces

SGPANEL n Most statements same as SGPLOT n Just add PANELBY statement n Produces separate plot for each value of PANELBY variable 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

Recommended paper Secrets of the SG Procedures by Dan Heath, SGF 2009 Find any SAS conference paper at www. lexjansen. com 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? Lora Delwiche Susan Slaughter llddelwiche@ucdavis. edu (530) 752 -9321 susan@avocetsolutions. com www.

Any Questions? Lora Delwiche Susan Slaughter llddelwiche@ucdavis. edu (530) 752 -9321 susan@avocetsolutions. com www. avocetsolutions. com The Little SAS Book: A Primer Fourth Edition 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.