Controlling SAS Graphics using ANNOTATE Datasets Elizabeth Campagna University of Colorado Denver Colorado Health Outcomes Program Colorado Day – Denver.

Slides:



Advertisements
Similar presentations
Summary Statistics/Simple Graphs in SAS/EXCEL/JMP.
Advertisements

Zhongmin Li and Geeta Mahendra
Using ODS Regions to Create Custom Reports Kate Morrow, M.S. Statistician Vermont Oxford Network, Burlington, VT.
Fundamental Features of Graphs All graphs have two, clearly-labeled axes that are drawn at a right angle. –The horizontal axis is the abscissa, or X-axis.
Microsoft Excel 2003 Illustrated Complete A Worksheet Formatting.
FIRST COURSE Excel Tutorial 4 Working with Charts and Graphics.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Excel 2003 Lab 2 Charting Worksheet Data.
1 CA201 Word Application Working with Graphics Week # 6 By Tariq Ibn Aziz Dammam Community college.
2 Part II Enhancing a Presentation Changing the Presentation Design Design template Professionally created slide designs contain –Color schemes –Custom.
COMPREHENSIVE Excel Tutorial 4 Working with Charts and Graphics.
XP New Perspectives on Microsoft Office Excel 2003 Tutorial 4 1 Microsoft Office Excel 2003 Tutorial 4 – Working With Charts and Graphics.
The gchart Procedure The gchart Procedure is used to create bar charts of various types (it can also create pie charts. It’s most basic form would look.
Instructor: Professor Cora Martinez, PhD Department of Civil and Environmental Engineering Florida International University.
WORKING WITH CHARTS. OBJECTIVES  Plan a chart  Create a chart  Move and resize a chart  Change the chart design  Change the chart layout  Format.
SAS® Maps as Tools to Display and Clarify Healthcare Outcomes Barbara B. Okerson, HMC, Richmond, VA.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
ENG College of Engineering Engineering Education Innovation Center 1 2D Plots 1 in MATLAB Topics Covered: 1.Plotting basic 2-D plots The plot()
C51BR Applications of Spreadsheets 1 Chapter 16 Getting Started Making Charts.
Microsoft Office XP Illustrated Introductory, Enhanced A Worksheet Formatting.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
Chapter 13: Interpreting Graphic Aids
Tips & Tricks MASUG02/18/2005. Multiple Graphs on One Page.
Examples of different formulas and their uses....
Chapter 9 Creating and Designing Graphs. Creating a Graph A graph is a diagram of data that shows relationship among a set of numbers. Data can be represented.
Microsoft Office Illustrated Introductory, Premium Edition with Charts Working.
Microsoft Office Illustrated Introductory, Premium Edition A Presentation Modifying.
Microsoft Office XP Illustrated Introductory, Enhanced A Presentation Modifying.
A Picture Is Worth A Thousand Words. DAY 7: EXCEL CHAPTER 4 Tazin Afrin September 10,
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. M I C R O S O F T ® Creating Charts Lesson 6.
Microsoft ® Office Excel 2007 Working with Charts.
Microsoft Office Illustrated Fundamentals Unit I: Working with Charts.
Introduction to SAS/Graph 9.2 Ken Barz Colorado Prevention Center 22Oct2009 Ken Barz Colorado Prevention Center.
Excel chapter 4.
ON PATHS LESS TRODDEN… Excursions in SAS/GRAPH ® and PROC TABULATE Presented by Aaron Rabushka © Aaron Rabushka 2000.
Copyright © 2008 Pearson Prentice Hall. All rights reserved Committed to Shaping the Next Generation of IT Experts. Chapter 5 Charts and Graphs Robert.
Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker.
Effective SAS greplay’ing and how to avoid stretching By David Mottershead Senior Programmer, Quanticate.
McGraw-Hill Career Education© 2008 by the McGraw-Hill Companies, Inc. All Rights Reserved. Office Excel 2007 Lab 2 Charting Worksheet Data.
PowerPoint Lesson 6 Working with Tables and Charts Microsoft Office 2010 Advanced Cable / Morrison 1.
PROC GPLOT GPLOT is used to make two dimensional scatter-plots. General Syntax: proc gplot data=data-set options; plot y-variable*x-variable/options; run;
MASUG September 15, Agenda  Guest Introductions  John Boling – SAS inSchool  Tim Garton – Health Forecasts  Announcements  Tips & Tricks 
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
Chapter 15: Spreadsheet and Worksheet Basics Lesson 96: Worksheets with Charts © 2010, 2006 South-Western, Cengage Learning.
SAS ® is a very powerful tool when producing Graphics. A single graphical data step can easily create a Kaplan Meier Plot, but there is no single graphical.
Introduction to Engineering MATLAB – 9 Plotting - 2 Agenda Formatting plots.
SAS/GRAPH The Basics. Today’s Topics GOPTIONS GPLOT GCHART GCONTOUR G3D.
Excel Part 4 Working with Charts and Graphics. XP Objectives Create an embedded chart Work with chart titles and legends Create and format a pie chart.
Excel Part 4 Working with Charts and Graphics. XP Objectives Create an embedded chart Work with chart titles and legends Create and format a pie chart.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Lesson 4 Inserting.
CMS SAS Users Group Conference Learn more about THE POWER TO KNOW ® October 17, 2011 PROC GMAP, HTML and You Thomas Kornfield, CMS.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Microsoft Office XP Illustrated Introductory, Enhanced With Charts Working.
Microsoft Office 2013: In Practice Chapter 2 Illustrating Slides with Pictures and Information Graphics Copyright © 2014 by The McGraw-Hill Companies,
Charts MOAC Lesson 6.
CMS SAS Users Group Conference Learn more about THE POWER TO KNOW ® October 17, 2011 Using SAS® to Create Custom Healthcare Graphics Barbara B. Okerson.
Behind the Scenes with SAS®: Using Customer Graphics in SAS® Output Louise Hadden Abt Associates Inc.
Charts MOAC Lesson 6.
Excel Part 4 Working with Charts and Graphics
Excel Part 4 Working with Charts and Graphics
Microsoft PowerPoint 2003 Illustrated Introductory
Tell a Story with the Data
Microsoft Excel Illustrated
Microsoft Office Illustrated Introductory, Windows XP Edition
Computing for Research I 01/26/2011 N. Baker
Charts MOAC Lesson 6.
Ch 1 G’raph Science.
Changing and Customizing Maps
Making a Publication-quality Graph in SAS
Excel Part 4 Working with Charts and Graphics
Microsoft Office Illustrated Fundamentals
Presentation transcript:

Controlling SAS Graphics using ANNOTATE Datasets Elizabeth Campagna University of Colorado Denver Colorado Health Outcomes Program Colorado Day – Denver SAS Users Group, September

Outline Why use ANNOTATE How to use an ANNOTATE dataset What is an ANNOTATE dataset Examples References ANNOTATE Custom SAS Graphics Built-In SAS Graphics

Why? Enhancement and modification of graphical features - flexibility to add any drawing object or text, in any format or color, to any place on your graphical output –Position text labels in a graph –Create custom legends –Draw lines between points –Add symbols at specific locations

How? Create an ANNOTATE dataset Execute the ANNOTATE commands by including the following option in your SAS/GRAPH code SAS/GRAPH interprets and executes the drawing commands along with the graph and creates output that has both included PROC GPLOT data=apple / ANNOTATE= ; PLOT color*state; RUN;

What? Ordinary SAS dataset Each observation is a drawing command defined by the values placed in each of the specific variables. Variables are constricted in values/attributes they can have Variables in an ANNOTATE dataset ALL information What is to be done? FUNCTION How is it to be done? COLOR, SIZE, STYLE, POSITION Where is it to be done? X, Y, XSYS, YSYS

What? lowupgrpgrplabelsxyposition Adjusted+Hospital Effect Adjusted+Hospital Effect Adjusted+Hospital Effect Adjusted+Hospital Effect functioncolortextstylexsysysyssizelinemid symbolblackdotnone MOVEblackdotnone DRAWblackdotnone labelblackIncreased Likelihood'Arial' FUNCTION variable tells SAS what to do, the other variables all modify, specify, or locate the function.

FUNCTION (what) LABELdraws text MOVEmoves to a specific point DRAWdraws a line from the current position to a specified position POLYspecifies the starting point of a polygon POLYCONTcontinues drawing the polygon BARdraws a rectangle from the current position to a specified position SYMBOLdraws a symbol. PIEdraws a pie slice, circle or arc. MOVEmove to the new x,y coordinates

Attributes (how) ANGLEangle of text label or starting angle of a pie slice CBORDERcolored border around text or symbol CBOXcolored box behind text or symbol COLORcolor of a graphics primitive LINEline type to use in drawing or special control over pies and bars POSITIONplacement and alignment for text strings ROTATE angle at which to place individual characters in a text string or the delta angle (sweep) of a pie slice SIZE size of an aspect of a graphics primitive; depends on FUNCTION variable (for TEXT, height of characters; for PIE, pie slice radius; for DRAW, line thickness; and so on) STYLE font or pattern for a graphics element, depends on the FUNCTION variable TEXTtext to use in a label, symbol, or comment Attributes are RETAINED between functions unless re-defined

Dimensions (where) X The numeric horizontal coordinate. Y The numeric vertical coordinate. Z For three-dimensional graphs, specifies the coordinate for the 3rd dimension. XSYS The coordinate system for the X variable. YSYS The coordinate system for the Y variable. ZSYS The coordinate system for the Z variable (for three-dimensional graphs).

Dimensions (where) Example: XSYS=‘1’; YSYS=‘A’;

ANNOTATE MACROS ANNOTATE macros within a SAS DATA step simplify the process of creating ANNOTATE observations. Specify a function and assign variable values (attributes) in one step You can mix assignment statements and macro calls in the same DATA step. Execute: “%annomac;” to make ANNOTATE macros available %LINE(x1, y1, x2, y2, color, line, size);draw a line %BAR(x1, y1, x2, y2, color, line, style);draw a bar %CIRCLE(x, y, size, color);draw a circle %DRAW(x, y, color, line, size);draw a line from previous point %RECT(x 1,y 1,x 2,y 2, color, line, size);draw a rectangle %LABEL(x, y, text, color, angle, rotate, size, style, position); draw text %MOVE(x, y);move to a point without drawing

Example How to draw lines, place symbols, & place text Changing attributes Illustrate the use of various coordinate systems Use of ANNOTATE macros midlowupgrpgrplabels Adjusted+Hospital Effect Adjusted Unadjusted

Goal

SAS Code - ANNOTATE %annomac; data anno; length function color style $8 text $40; xsys='2'; ysys='2'; size=1; line=1; color='black'; set test; * plot Odds Ratios; function='symbol'; style='none' ; text='dot'; x=mid; y=grp; output; * add horizontal lines representing OR CI; function='move'; x=low; y=grp; output; function='draw'; x=up; y=grp; output; * add vertical lines at end of CI; %LINE (low, grp-0.05, low, grp+0.05, black, 1, 1); %LINE (up, grp-0.05, up, grp+0.05, black, 1, 1); * labels; function='label'; style="'Arial'"; size=1.5; x=low; y=grp; position="3"; text=grplabels; output; * use graphics output area for vertical positioning to set x-axis labels below data area; ysys='3'; position="5"; function='label'; size=1.75; x=0.3; y=11; text="Decreased Likelihood"; output; function='label'; x=3; text="Increased Likelihood"; output; run;

* plot Odds Ratios; function='symbol'; style='none' ; text='dot'; x=mid; y=grp; output;

* add horizontal lines representing OR CI; function='move'; x=low; y=grp; output; function='draw'; x=up; y=grp; output;

* add vertical lines at end of CI; %LINE (low, grp-0.05, low, grp+0.05, black, 1, 1); %LINE (up, grp-0.05, up, grp+0.05, black, 1, 1);

function='label'; style="'Arial'"; size=1.5; x=low; y=grp; position="3"; text=grplabels; output;

* use graphics output area for vertical positioning to set x-axis labels below data area; ysys='3'; position="5"; function='label'; size=1.75; x=0.3; y=11; text="Decreased Likelihood"; output; function='label'; x=3; text="Increased Likelihood"; output;

SAS Code – Proc GPLOT goptions reset=all; goptions cback=white ctext=black ftitle='Arial' ftext="Arial" fby='Arial' htitle=2 htext=12 PT gsfname=plots device=gif xmax=6 IN ymax=4 IN; axis1 logbase=10 logstyle=expand order=( ) label=(font='Arial' height=12 PT justify=center ''); axis2 order=(0 to 4 by 1) /* change max axis value as needed (# grps + 1) */ color=white; symbol1 i=none; title 'Odds Ratios w/95% CI'; footnote 'Denver SAS Users Group Colorado Day 2008'; filename plots "H:\misc\DSUG\2008\plot1.gif"; proc gplot data=test; plot grp*up / anno=anno haxis=axis1 vaxis=axis2 href=1 noframe; run; quit; title; footnote;

End Result

References Introduction to SAS/Graph Michael Friendly Statistical Consulting Service SUGI 31, Paper Improving Your Graphics Using SAS/GRAPH® ANNOTATE Facility David Mink, Ovation Research Group, San Francisco, CA David J. Pasta, Ovation Research Group, San Francisco, CA Data Driven Annotations: An Introduction to SAS/GRAPH’s® ANNOTATE Facility Arthur L. Carpenter California Occidental Consultants SAS OnlineDoc SAS/GRAPH Reference > The ANNOTATE Facility