WORKING IN SGPLOT. Understanding the General Logic of Attributes

Similar documents
WORKING IN SGPLOT. Understanding the General Logic of Attributes

Introducing Statistical Graphics (SG): Victoria UG May 2018 Mary Harding SAS Canada

Putting on the Ritz: New Ways to Style Your ODS Graphics to the Max

Getting Started with the SGPLOT Procedure

Introduction to SAS/GRAPH Statistical Graphics Procedures

SAS Graph a Million with the SGPLOT Procedure. Prashant Hebbar, Sanjay Matange

Need a Scientific Journal Ready Graphic? No Problem!

Intermediate SAS ODS Graphics Chuck Kincaid, Experis Business Analytics, Kalamazoo, MI

Patient Profile Graphs using SAS. Sanjay Matange, SAS Institute, Inc.

Using PROC SGPLOT for Quick High-Quality Graphs

Introduction to Statistical Graphics Procedures

Creating Graphs Using SAS ODS Graphics Designer

Graphing Made Easy with ODS Graphics Procedures

Graphing Made Easy with SGPLOT and SGPANEL Procedures

%EventChart: A Macro to Visualize Data with Multiple Timed Events

Decorative InfoGraphs using SAS

Stylizing your SAS graph A needs-based approach

Enhanced Swimmer Plots: Tell More Sophisticated Graphic Stories in Oncology Studies

Introduction to ODS Graphics for the Non-Statistician

Key Features in ODS Graphics for Efficient Clinical Graphing Yuxin (Ellen) Jiang, Biogen, Cambridge, MA

Charts in Excel 2003

Great Time to Learn GTL

Paper Some Tricks in Graph Template Language Amos Shu, AstraZeneca Pharmaceuticals, LP

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

Submission Guideline Checklist

Converting Annotate to ODS Graphics. Is It Possible?

What could ODS graphics do about Box Plot?

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

Technology Assignment: Scatter Plots

BioFuel Graphing instructions using Microsoft Excel 2003 (Microsoft Excel 2007 instructions start on page mei-7)

Creating Presentation-Quality ODS Graphics Output

CAPE. Community Behavioral Health Data. How to Create CAPE. Community Assessment and Education to Promote Behavioral Health Planning and Evaluation

Final Exam. STT 305 Summer 2017

FILLPATTERNS in SGPLOT Graphs Pankhil Shah, PPD, Morrisville, NC

Advanced Graphs using Axis Tables

Section 33: Advanced Charts

Scientific Graphing in Excel 2013

Creating Graph Collections with Consistent Colours using ODS Graphics. Philip R Holland, Holland Numerics Ltd

A Visual Revolution Statistical Graphics in SAS 9.2 Bob Newman, Amadeus Software Limited

SAMLab Tip Sheet #5 Creating Graphs

SAS Visual Analytics 8.2: Working with Report Content

Exercise 4a: Creating and Editing XY Plots

Creating a Basic Chart in Excel 2007

Introduction to CS graphs and plots in Excel Jacek Wiślicki, Laurent Babout,

Chemistry 30 Tips for Creating Graphs using Microsoft Excel

PRACTICE EXERCISES. Family Utility Expenses

MICROSOFT EXCEL Working with Charts

Developing Graphical Standards: A Collaborative, Cross-Functional Approach Mayur Uttarwar, Seattle Genetics, Inc., Bothell, WA

Office Excel. Charts

This activity will show you how to use Excel to draw cumulative frequency graphs. Earnings ( x/hour) 0 < x < x

A Combined AE + CM Graph using SAS

Understand and plan a chart Create a chart Move and resize charts and chart objects Apply chart layouts and styles

Building a Template from the Ground Up with GTL

A Practical Example of SGPLOT Using Logistic Regression

Charting Progress with a Spreadsheet

Information Technology and Media Services. Office Excel. Charts

EWMA / Time Series Plot Overlay

Chapter 2 Surfer Tutorial

COGCC GIS Online Map Tools-Intranet Site July 12, 2011

Appendix D CSS Properties and Values

Customizing Survival Curves

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below.

Excel 2010 Charts and Graphs

1. Step-by-Step: Change Fonts and Font Sizes a. Before you begin these steps, be sure to LAUNCH Microsoft Word. b. Connect your USB flash drive to

LBS Polytechnic. Hey! Make With The Style Sheet Already, Bub!

SAS GTL: Improving Patients Safety and Study Efficiency Masaki Mihaila, Medivation, Inc, San Francisco, CA

Scientific Graphing in Excel 2007

Brand Guidelines. version

Desktop Studio: Charts. Version: 7.3

New SAS/GRAPH Procedures for Creating Statistical Graphics in Data Analysis Dan Heath, SAS Institute Inc., Cary, NC

Stat 302 Statistical Software and Its Applications SAS: Distributions

Bar Charts and Frequency Distributions

You are to turn in the following three graphs at the beginning of class on Wednesday, January 21.

Desktop Studio: Charts

BASIC LOESS, PBSPLINE & SPLINE

Open a new Excel workbook and look for the Standard Toolbar.

CPM-200 User Guide For Lighthouse for MAX

IGCSE ICT Section 16 Presentation Authoring

Tutorials. Lesson 1 - Format a Schedule. In this lesson you will learn how to: Change the schedule s date range. Change the date headings.

The Chart Title can be formatted to change color, pattern, typeface, size and alignment using the Format Chart Title dialog box.

CSS. Lecture 16 COMPSCI 111/111G SS 2018

2. In the Start and End Dates section, use the Calendar icon to change the Displayed Start Date to 1/1/2015 and the Displayed End Date to 5/31/2015.

Using Charts in a Presentation 6

Brand Standards 2014

How to Make a Poster Using PowerPoint

Macros for creating a custom report of figures

CSS Lecture 16 COMPSCI 111/111G SS 2018

Introduction to Microsoft Office PowerPoint 2010

CHAPTER 1 Introduction to SAS/GRAPH Software

Microsoft Excel 2007

Lesson 16: More on Modeling Relationships with a Line

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

Logo. Primary. Secondary

Read More: How to Make a Pie Chart in Excel [Video Tutorial]

Making Your SAS Results, Reports, Tables, Charts and Spreadsheets More Meaningful with Color

How to plot basic charts with plotly

Designing and Creating an Academic Poster using PowerPoint

Chemistry Excel. Microsoft 2007

Introduction to ODS Statistical Graphics

Graphing Interface Overview

Transcription:

WORKING IN SGPLOT Understanding the General Logic of Attributes

Graphical Elements in SGPLOT All graphs generated by SGPLOT can be viewed as a collection of elements. Some of the nomenclature of these elements is the same or similar to that which was utilized in SAS/GRAPH. Labels on axes, along with values at major tick marks. Legends still have values for each category, but in SGPLOT we have a title instead of a label. In scatterplots, and related graphs, we have markers the keyword symbol is used to refer to their shape. Any of the elements can potentially be re-styled by altering their attributes. In SGPLOT, graphical elements are divided into various types that have common attribute sets. 2

Two Simple Plots Bar Chart hbar origin / response=mpg_city stat=mean; 3

Two Simple Plots Bar Chart hbar origin / response=mpg_city stat=mean; Labels and values on any axis are text graphical elements. For text, 5 attributes can be set: 4

Two Simple Plots Bar Chart hbar origin / response=mpg_city stat=mean; Labels and values on any axis are text elements. For text, 5 attributes can be set: Font, size, color, style and weight 5

Two Simple Plots Bar Chart hbar origin / response=mpg_city stat=mean; In their default form, bars have two elements fill and outline. Fills and lines each have their own attribute sets. 6

Two Simple Plots Bar Chart hbar origin / response=mpg_city stat=mean; Fill allows for color and transparency. Line allows color, pattern and thickness. 7

Two Simple Plots Scatterplot scatter x=horsepower y=mpg_city; where type ne 'Hybrid'; 8

Two Simple Plots Scatterplot scatter x=horsepower y=mpg_city; where type ne 'Hybrid'; One element the bar graph does not have is the marker, which the scatterplot contains by default. 9

Two Simple Plots Scatterplot scatter x=horsepower y=mpg_city; where type ne 'Hybrid'; For markers, color, size and symbol can all be set. 10

The Fill Attribute We will start by modifying the bar fill in the first graph. Fill attributes available for modification are: Color in any of the SAS color models Transparency a proportion, from 0 to 1, with 0 being fully opaque Since the hbar statement generates the bars, these attributes can be set as an option in the hbar statement, in general: The keyword is derived from the element name with the suffix attrs For the bar fill, we will use fillattrs=(options) It is also possible to assign a style element as part of this specification beyond the scope of this lesson 11

The Fill Attribute hbar origin / response=mpg_city stat=mean fillattrs=(color=cxffaa00); Add fillattrs to your list of hbar options and choose your favorite color. 12

The Fill Attribute hbar origin / response=mpg_city stat=mean fillattrs=(c=cxffaa00); If you are used to SAS/GRAPH, common aliases do not work here. 13

The Fill Attribute hbar origin / response=mpg_city stat=mean fillattrs=(color=cxffaa00 transparency=0.5); With no overlays of graphs, transparency amounts to little more than a lightening of the color. 14

The Fill Attribute hbar origin / response=mpg_city stat=mean; hbar origin / response=mpg_highway stat=mean fillattrs=(transparency=0.4 color=yellow); Here, yellow bars for highway MPG overlay the default blue bars for city. The transparency effect results in a green for the city bars. 15

The Fill Attribute hbar origin / response=mpg_city stat=mean; hbar origin / response=mpg_highway stat=mean fillattrs=(transparency=0.4 color=cxff6666) barwidth=0.6; Some care with colors and bar sizes can be helpful in these situations. 16

Text Attributes Returning to our simple bar graph, we will alter text styles. Text attributes available for modification are: Color in any of the SAS color models Family any font available in your session Size in various units: cm, mm, in, pct, pt, px Style normal or italic Weight normal or bold The hbar statement generates text only due to the axes: The only text modifications we can make to the original graph will be in an xaxis or yaxis statement. The keyword is still derived from the element name with the suffix attrs For the labels, we will use labelattrs=(options) for the values, we will use valueattrs=(options) 17

Text Attributes hbar origin / response=mpg_city stat=mean; yaxis display=(nolabel) valueattrs=(size=14pt style=italic); xaxis labelattrs=(family='arial Black'); So in each axis statement we have modified one of the text elements. 18

Text Attributes hbar origin / response=mpg_city stat=mean; yaxis display=(nolabel) valueattrs=(size=14pt style=italic); xaxis labelattrs=(family='arial Black'); 19

Text Attributes hbar origin / response=mpg_city stat=mean; yaxis display=(nolabel) valueattrs=(size=14pt style=italic); xaxis labelattrs=(family='arial Black'); 20

Exercise hbar origin / response=mpg_city stat=mean datalabel; Of course, text may appear in the graph area for a bar graph, such as when the datalabel option is used. Can you modify the attributes of the data labels? 21

Exercise hbar origin / response=mpg_city stat=mean datalabel datalabelattrs=(family='georgia' size=12pt); Following the rules, the attribute keyword must be datalabelattrs (yes they can get long) and it must be an option in the graphing statement. Any option that generates a graphic element can be reliably linked to its attrs keyword. 22

Line Attributes Returning to our simple bar graph, we will alter the bar outlines. Line attributes available for modification are: Color in any of the SAS color models Pattern numbers 1 to 46 for various patterns (or names for named patterns) Thickness in various units: cm, mm, in, pct, pt, px Since the hbar statement generates the bars with outlines (by default), these attributes can be set as an option in the hbar statement : The keyword is still derived from the element name with the suffix attrs So we will use outlineattrs=(options) 23

Line Attributes hbar origin / response=mpg_city stat=mean outlineattrs=(color=cxffaa55 thickness=2pt); Knowing the names of default graph elements is helpful, as it gives a direct link to the attrs keyword. 24

Marker Attributes The final type of graph element associated with attributes are markers we will use the scatterplot to look at these. Marker attributes available for modification are: Color in any of the SAS color models Size in various units: cm, mm, in, pct, pt, px Symbol various shapes, see next slide for choices The scatter statement generates a marker at each data point: The keyword is still derived from the element name with the suffix attrs So we will use markerattrs=(options) as an option in the scatter statement 25

Marker Symbols 26

Marker Attributes scatter x=horsepower y=mpg_city/ markerattrs=(symbol=squarefilled color=cxaa6666 size=4pt); where type ne 'Hybrid'; Whatever is chosen is applied to all markers. 27

Marker Attributes A Special Case scatter x=horsepower y=mpg_city/filledoutlinedmarkers markerattrs=(symbol=squarefilled color=cxaa6666 size=4pt); where type ne 'Hybrid'; The option filledoutlinedmarkers (yes these can be long) gives a peculiar result with our previous attributes. The shape is correct (a filled symbol is required for filledoutlinedmarkers to work) and the size is also. However, neither the fill nor the outline use the red. Can you figure out why and modify these to have a fill of a bright blue and an outline in the red we used? 28

Marker Attributes A Special Case scatter x=horsepower y=mpg_city/filledoutlinedmarkers markerattrs=(symbol=squarefilled size=4pt) markerfillattrs=(color=blue) markeroutlineattrs=(color=cxaa6666); where type ne 'Hybrid'; With filledoutlinedmarkers, the marker fill and outline become separate elements. Realizing this, then it follows that each gets its own attrs keyword. 29

Groups hbar origin / response=mpg_city stat=mean group=type groupdisplay=cluster; where type not in ('Truck','Hybrid'); scatter x=horsepower y=mpg_city/ group=origin; where type ne 'Hybrid'; Each of the graph types we have worked with supports grouping; however 30

Groups hbar origin / response=mpg_city stat=mean group=type groupdisplay=cluster; where type not in ('Truck','Hybrid'); scatter x=horsepower y=mpg_city/ group=origin; where type ne 'Hybrid'; The attribute modifiers we have used for these only allow one value to be set which applies to all such elements. 31

styleattrs Statement styleattrs datacolors=(cx66ff66 cxff6666 cx6666ff cxffaa66); hbar origin / response=mpg_city stat=mean group=type groupdisplay=cluster; where type not in ('Truck','Hybrid'); The styleattrs statement can be used to set lists of values to replace the default lists SAS cycles through. 32

styleattrs Statement styleattrs datacolors=(cx66ff66 cxff6666 cx6666ff cxffaa66); hbar origin / response=mpg_city stat=mean group=type groupdisplay=cluster; where type not in ('Truck','Hybrid'); The datacolors option lets you set the list of fill colors. 33

styleattrs Statement styleattrs datasymbols=(trianglefilled squarefilled starfilled); scatter x=horsepower y=mpg_city/group=origin; where type ne 'Hybrid'; The datasymbols option lets you set the list of marker shapes. 34

styleattrs Statement styleattrs datasymbols=(trianglefilled squarefilled starfilled) datacontrastcolors=(red green blue); scatter x=horsepower y=mpg_city/ group=origin; where type ne 'Hybrid'; The datacontrastcolors option lets you set the list of marker colors (and lines, if applicable). 35

Styleattrs Statement Also includes: datalinepatterns patterns for line elements backcolor background color of the graph wallcolor color for the plot wall Maintenance release 3 and above for the color options 36

Symbol and Color Priority for Markers styleattrs datasymbols=(trianglefilled squarefilled) datacontrastcolors=(red green); scatter x=horsepower y=mpg_city/ group=origin; where type ne 'Hybrid'; Because of the default behavior of changing color an symbol simultaneously, the four combinations that could be created from 2 colors and 2 shapes are not used effectively by default. 37

attrpriority Option in ODS Graphics ods graphics / attrpriority=color; styleattrs datasymbols=(trianglefilled squarefilled) datacontrastcolors=(red green); scatter x=horsepower y=mpg_city/ group=origin; where type ne 'Hybrid'; The default setting for attrpriority is none, which can be changed only to color. This causes SAS to cycle through colors prior to cycling through symbols. 38