... WHERE. AnnotaI8 Data.S... XSYS & YSYS. Harie Annotate: How Not to Lose Your Head When Enhancing BAS/GRAPH output

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

INTRODUCTION TO THE SAS ANNOTATE FACILITY

Using ANNOTATE MACROS as Shortcuts

Multiple Forest Plots and the SAS System

The GANNO Procedure. Overview CHAPTER 12

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

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

PROC REPORT Basics: Getting Started with the Primary Statements

Arthur L. Carpenter California Occidental Consultants

Arthur L. Carpenter California Occidental Consultants, Oceanside, California

Custom Map Displays Created with SAS/GRAPH Procedures and the Annotate Facility Debra Miller, National Park Service, Denver, CO

Data Annotations in Clinical Trial Graphs Sudhir Singh, i3 Statprobe, Cary, NC

Using SAS/GRAPH Software to Analyze Student Study Habits. Bill Wallace Computing Services University of Saskatchewan

Displaying Multiple Graphs to Quickly Assess Patient Data Trends

Figure 1. Paper Ring Charts. David Corliss, Marketing Associates, Bloomfield Hills, MI

Move =(+0,+5): Making SAS/GRAPH Work For You

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

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

Coders' Corner. Paper ABSTRACT GLOBAL STATEMENTS INTRODUCTION

spin, Rotate, and view Three Dimensional Point Clouds: Dynamic Exploration of sets without SAS/INSIGHT 1H Arthur L.

Presentation Quality Graphics with SAS/GRAPH

Volume is m 3 0f H 2. SAS/GRAPH" Odds and Ends; Little Things That Make a Big Difference. Arthur L. Carpenter ABSTRACT TEXT OPTIONS IN TITLES

The GSLIDE Procedure. Overview. About Text Slides CHAPTER 27

Creating Forest Plots Using SAS/GRAPH and the Annotate Facility

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

Annotate Dictionary CHAPTER 11

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

Customized Flowcharts Using SAS Annotation Abhinav Srivastva, PaxVax Inc., Redwood City, CA

Create Flowcharts Using Annotate Facility. Priya Saradha & Gurubaran Veeravel

PharmaSUG Paper TT10 Creating a Customized Graph for Adverse Event Incidence and Duration Sanjiv Ramalingam, Octagon Research Solutions Inc.

MANAGING SAS/GRAPH DISPLAYS WITH THE GREPLAY PROCEDURE. Perry Watts IMS Health

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

Creating Maps in SAS/GRAPH

Job Security: Using the SAS Macro Language to Full Advantage

PharmaSUG 2012 Paper CC13

SAS/GRAPH : Using the Annotate Facility

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

SAS/GRAPH and ANNOTATE Facility More Than Just a Bunch of Labels and Lines

Generating Participant Specific Figures Using SAS Graphic Procedures Carry Croghan and Marsha Morgan, EPA, Research Triangle Park, NC

KEYWORDS Metadata, macro language, CALL EXECUTE, %NRSTR, %TSLIT

THE IMPACT OF DATA VISUALIZATION IN A STUDY OF CHRONIC DISEASE

* builds the RGB color string from the color. * reads the red, green; and blue values for. * constructs an ANNOTATE dataset by

ODS LAYOUT is Like an Onion

Pete Lund Looking Glass Analytics, Olympia, WA

Importing CSV Data to All Character Variables Arthur L. Carpenter California Occidental Consultants, Anchorage, AK

SparkLines Using SAS and JMP

Using Annotate Datasets to Enhance Charts of Data with Confidence Intervals: Data-Driven Graphical Presentation

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

Creating Complex Graphics for Survival Analyses with the SAS System

Advanced PROC REPORT: Getting Your Tables Connected Using Links

Using SAS Graphics Capabilities to Display Air Quality Data Debbie Miller, National Park Service, Denver, CO

Arthur L. Carpenter California Occidental Consultants

Paper S Data Presentation 101: An Analyst s Perspective

Posters 417. NESUG '92 Proceedings. usinq Annotate Data sets to Enhance Contour Graphics output. Shi Tao Yeh, Environmental Resources Kanaqement, ~nc.

Put Your Data on the Map: Using the GEOCODE and GMAP Procedures to Create Bubble Maps in SAS

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

Quick Results with the Output Delivery System

title1 "Visits at &string1"; proc print data=hospitalvisits; where sitecode="&string1";

Using PROC FCMP to the Fullest: Getting Started and Doing More

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

How to Make an Impressive Map of the United States with SAS/Graph for Beginners Sharon Avrunin-Becker, Westat, Rockville, MD

Using PROC FCMP to the Fullest: Getting Started and Doing More

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

Graphics. Chapter Overview CHAPTER 4

PharmaSUG 2015 Paper PO03

Reading and Writing RTF Documents as Data: Automatic Completion of CONSORT Flow Diagrams

A Picture is worth 3000 words!! 3D Visualization using SAS Suhas R. Sanjee, Novartis Institutes for Biomedical Research, INC.

Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA

Taming the Box Plot. Sanjiv Ramalingam, Octagon Research Solutions, Inc., Wayne, PA

Report Writing, SAS/GRAPH Creation, and Output Verification using SAS/ASSIST Matthew J. Becker, ST TPROBE, inc., Ann Arbor, MI

How to annotate graphics

New SAS/GRAPH Features. Jack Bulkley, SAS Institute Inc. GPLOT INTRODUCTION

SAS/GRAPH Blues? SAS/FRAME to the Rescue Kathy Shelley, Iowa State University, Ames, Iowa

Innovative Graph for Comparing Central Tendencies and Spread at a Glance

KEYWORDS ARRAY statement, DO loop, temporary arrays, MERGE statement, Hash Objects, Big Data, Brute force Techniques, PROC PHREG

Tips and Tricks in Creating Graphs Using PROC GPLOT

An Introduction to PROC REPORT

Chapter 3 Analyzing Normal Quantitative Data

A Juxtaposition of Tables and Graphs Using SAS /GRAPH Procedures

Using Graph-N-Go With ODS to Easily Present Your Data and Web-Enable Your Graphs Curtis A. Smith, Defense Contract Audit Agency, La Mirada, CA

Table Lookups: From IF-THEN to Key-Indexing

PLA YING WITH MACROS: TAKE THE WORK OUT OF LEARNING TO DO MACROS. Arthur L. Carpenter

Chapter 10 Working with Graphs and Charts

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

SAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD

Arthur L. Carpenter California Occidental Consultants

Topic. Section 4.1 (3, 4)

Data Explore Matrix Quality Control by Exploring and Mining Data in Clinical Study

When Simpler is Better Visualizing Laboratory Data Using SG Procedures Wei Cheng, Isis Pharmaceuticals, Inc., Carlsbad, CA

SAS CLINICAL SYLLABUS. DURATION: - 60 Hours

An Introduction to PROC GREPLAY

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

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

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

USING PROC GMAP AND DRILL-DOWN GRAPHICS FOR DATA QUALITY ASSURANCE Meghan Arbogast, Computer Sciences Corporation, Corvallis, OR

A Stand-Alone SAS Annotate System for Figure Generation Brian Fairfield-Carter, PRA International, Victoria, BC

Reverse-engineer a Reference Curve: Capturing Tabular Data from Graphical Output Brian Fairfield-Carter, ICON Clinical Research, Redwood City, CA

The GREMOVE Procedure

Making Science Graphs and Interpreting Data

Picturing Statistics Diana Suhr, University of Northern Colorado

Transcription:

Harie Annotate: How Not to Lose Your Head When Enhancing BAS/GRAPH output Arthur La Carpenter California occidental consultants KEY WORDS ANNOTATE, GRAPHICS, FRANCE, GSLIDE, GANNO, FUNCTION INTRODUCTION The ANNOTATE Facility within SAS/GRAPH has a reputation for causing new graphics users head aches and frustration a Much of the confusion is caused by the approach that ANNOTATE uses to gather the information it needs to place text, lines, and symbols on the plot or graph a ANNOTATE is not like the rest of SAS. Directions are not passed to the ANNOTATE Facility using a PROCedural call. specific statements are ~ot,used to define parameters. Informat~on ~s passed to a PROCedure through a SAS data set. To make matters a "bit more arcane, the user of the ANNOTATE data set is not free to select variable names or their attributes. This is very contrary to both the traditional DATA step and the PROC step. This paper will introduce the concept of a data set which is used to transmit informational values to a PROCedure. Selected ANNOTATE variables will be introduced and discussed, and the resulting ANNOTATE data set will be used to enhance graphics output. ANNOTATE DATA BET (WHERE, WHAT, and HOW) The purpose of the ANNOTATE data se~ is to pass information to the appropr~ate PROCedure. Individual PROCedures are/were not designed to accommodate the flexibility required for the types of graphics enhancements possible through the ANNOTATE Facility. In the data step, the user creates an ANNOTATE data set which contains the functional information directly applicable to the graphics output. Although it at first seems clumsy to pass specific information to a PROCedure through the use of dedicated data sets, PROCedures are actually designed to accept, interpret, and respond to SAS data sets. Therefore, an ANNOTATE data set can contain the functional information and PROCedure statements that could not be included in the PROC step itself. The result is a stronger and more flexible approach. Although an ANNOTATE data set can contain over twenty variables that have specific meanings, the new user need not master all of them prior to creating an ANNOTATEd plot or graph. Basically the two questions of WHERE and WHAT need to be answered by the information contained in the data set. Often this information is conveyed by the three primary ANNOTATE variables; FUNCTION, X, and Y. FUNCTION tells ANNOTATE what to do and X and Y tell it where to do it. Most of the other ANNOTATE variables are used to enhance or supplement these three. AnnotaI8 Data.S... WHERE: WHERE WHAT HOW Figure 1 Funot lonall ty U_lng Annotate D.t.... Almost all uses of ANNOTATE require information of location, WHERE. The physical location on the graph depends on the coordinate system which can be selected by using the variables XSYS and YSYS (Figure 2) These character variables can take on one of twelve 'system' values as shown in Table 7.2 and Figure 7.1 of the BAS/GRAPH (Verson 6.03) User's Guide. WHERE Define available area XSYS & YSYS Figure 2 Each of these system values indicates if the coordinate system is to be measured in units (inches or em as defined in the GOPTIONS) or as a percentage of the available area. Using the simple plot shown in Figure 3, the available area can 743

Figure 3 " " ~ _» " H» be coded using XSYS and YSYS. areas can be the 'Graphics Area' 4), 'Window Area' (Figure 5), or Area' (Figure 6). These (Figure 'Screen The 'Graphics Area' will be defined by the extent of any axis that may be plotted. 'Window Areas' include all of the graph except the border areas utilized by titles and footnotes. And finally the 'Screen Area' includes the entire graphics area. The choices can be a bit daunting and while the power, like cake and other desserts, is nice, what we really need is a staple, bread. Two of the twelve choices of XSYS and YSYS will satisfy most of our ANNOTATE needs. Data driven applications will most often use 'absolute data' ('2') and text placement applications the 'absolute window percent I (' 5 ' ) The WHERE is further defined using the numeric coordinate variables X and Y, Figure 7, (and occasionally Z, but we Locate the Place x & y Figure 4 Figure 7 won't talk about that, this being a family book often used put people to sleep). The values of X and Y can be defined explicitly as in figures 8 & 9 or may be data driven. In either case X is used to define horizontal coordinates and Y, of course, the vertical. ":: Figure 5 ("'1) _ Figure 8..... define the lisys= '2'; YSYS= '2'; X= <19; Y= 7; label Figure 6 'IEIcI:='S '; styia='marmr'; position-'s'; CIUIput; tad:='(49.n'; styie='amssi'; positi)n - '9'; 0UIput; Figure 9 744

WHAT: The character variable FUNCTION provides the information of WHAT is to be done. Virtually all ANNOTATE data sets will have this variable defined for all observations. This variable provides the user the ability to express what is to be done. Consequently it is one of the best places for a new user to start when creating an ANNOTATE data set. Values of FUNCTION include MOVE and DRAW with a pen, add a LABEL, and to add SYMBOLs I BARs and POLYgons to a graph (Figure 10). Usually when a FUNCTION is defined, one or more supplemental variables will also be defined. The SAS/GRAPH Userls Guide (Release 6.03) TABLE 7.3 notes which of these variables is typically used with the basic FUNCTIONs. WHAT Figure 12 Labels?an easily be added to a plot by specify~ng FUNCTION='LABEL'. Figure 13 shows part of the code used to add a label to a plot. Two or more ANNOTATE data sets can easily be appended. Figure 14 sh~ws ~he results of the appended data used ~n F~gures 11 and 13. Def ne the task Figure 10 FUNCTION MOVE DRAW LABEL Spec I fy a Labe FUNCTION-'LABEL' ; X-50; V-50; TEXT-'JULV 14. 17871 The FUNCTION= 'MOVE, picks up and moves the pen to the specified location. When followed by a FUNCTION= I DRAW' a line is drawn to the second location. Using a series of MOVEs and DRAWs one is able-to sketch a simple to complex diagram (Figure 11). The window percentage coordinate system was used for both X and Y. X=50 indicates a position 50% of the way across the graphics window as measured from the left side (Figure 12). Figure 13 XSYS YSYS Y funotion.~.u.a ".10 dra. 12..."... d '-0.0000... 0... 1G.0aaa ".1O dra. Figure 14 Figure 11 Other variables are available to enhance the text's color, size, and font. The variables which may be used with FUNCTION='LABEL' are designated in TABLE 7.3 of the SAS/GRAPH User's Guide. And further detailed in the section entitled "outline of Use: Basic Functions" in the same manual. TEXT attributes are controlled in much the same way as they are in a SAS/GRAPH TITLE or FOOTNOTE. The size of the text) is controlled by the SIZE variable in much the same way as H= is used in a 745

TITLE statement. Font selection is through the STYLE variable which corresponds to the F=, and COLOR specifies the color as does C= in titles. DATA MARIE; LENGTH FUNCTION COLOR STYLE $8; FUNCTION='LABEL'; COLOR='BLUE'; STYLE='SCRIPT'; SIZE=4; TEXT='JULY 14, 1789'; X=30; Y=15; OUTPUT; PROC GSL IDE ANNO-TOWER; TITLE 'EIFFEL TOWER'; Figure 16 PROC GANNO ANNO=MARIE; TITLE H=2 F=SIMPLEX 'Bastille Day'; HOW: Once created, the ANNOTATE data with its functions, coordinates and associated variables must be passed to a PROCedure capable of using it. The display of ANNOTATE data commands can be accomplished in one of two basic ways, either through PROC GANNO or through the use of the ANNO~ option (Figure 15). EIFFE Figure 17 TOWER HOW Using Annotate Data Figure 15 PRoe GANNO PRoe GSLIDE ANNOTATE data sets can be utilized by most of the PROCedures in SAS/GRAPH. Most of these produce graphic output that can be enhanced by the information in an ANNOTATE data set, however, PROC GANNO only produces graphics as ---directed by ANNOTATE. In each of these PROCedures a PROC option is used to designate the annotate data set. This option takes the form of ANNOTATE=datasetname. Consider the ANNOTATE data set MARIE. It could be made available to the following PROCs: PROC GANNO ANNOTATE=MARIE; PROC GPLOT DATA=PLOTDATA ANNO=MARIE; PROC GPLOT DATA=PLOTDATA; PLOT VVAR*HVAR / ANNOTATE=MARIE; CREATING THE ANNOTATE DATA SET The ANNOTATE data set can be created in any of the ways that a SAS data set is created. In the previous section the data set MARIE is created using assignment statements, however, this becomes cumbersome if the data set is large. Often, if there are many commands, such as when drawing, a raw or flat file is created and read as data using the INPUT statement. When the graphics enhancement depends on an established SAS data set, that data set can sometimes be used to build the ANNOTATE data set as well. * Using a flat file; DATA TOWER; LENGTH FUNCTION $8; RETAIN XSYS YSYS '5' LINE 2; INPUT FUNCTION X Y; CARDS; MOVE 30 30 DRAW 30 32 DRAW 45 45 DRAW 30 30 PROC GANNO ANNO=TOWER; TITLE H=2 F=SIMPLEX 'Eiffle Tower'; When used together (Figure 16) the GSLIDE and the ANNO= can be used to combine both into a single plot (Figure 17). Existing SAS data sets can be used as the input to create an ANNOTATE data set. The two do nt)t necessarily need to be 746

distinct. PROC PRINT DATA=ACID; OBS 1 2 3 4 TEMP 16 20 15 12 TIloIE 5 12 23 41 ACID 25 15 8 3 DATA ANNPLT; SET ACID; LENGTH FUNCTION $8 TEXT $2; RETAIN XSYS YSYS '2' STYLE 'SIMPLEX' FUNCTION 'LABEL' POSITION 16'; DROP TEMP TIME ACID; X=TlMEi Y=TEMPi TEXT=PUT(ACID,2.); PROC GPLOT DATA=ACID ANNO=ANNPLT; PLOT TEMP"ACID; TITLE H=2 F=SIMPLEX 'Temp. & Cone.'; 'Concentration'; ANNPLT is essentially similar to MARIE, and only really differs in its method of creation. The variable POSITION determines where the text string is to be placed relative to the (X, Y) location. POSITION='6' indicates that the text will start immediately to the right of the plotted symbol. CHOOSING THE ANNOTATE VARIABLES The process of selecting the variables to include in the ANNOTATE data set should always start with FUNCTION. The value of the FUNCTION variable often will determine what other variables are needed. The User's Guide is organized to describe those variables that are associated with each value that FUNCTION can take on. The Release 6.03 SAS/GRAPH User's Guide (P. 130) details other variables that could have been selected. These include font selection (STYLE), size of the text (SIZE), color of text (COLOR), and the position of the text relative to the designated coordinate (POSITION). Next, in all but two of the functions, the location on the graph must be selected. The coordinates are usually placed in the variables X and Y. The coordinate system may also need to be selected. This process can be summarized as: IV SUMMARY Assign values to the ANNOTATE data set The construction of ANNOTATE data sets is often viewed as a daunting task for users who are unfamiliar with the approach used by SAS/GRAPH to assimilate the ANNOTATE commands. The ANNOTATE data set can be seen as a way to transfer these commands into a SAS/GRAPH PROCedure. The construction of the data set is fairly straightforward as long as the user starts with the definition of the FUNCTION of each observation in the ANNOTATE data set. The FUNCTION determines for the most part what other variables will be needed. After selection of the value of FUNCTION and appropriate support variables, the coordinates (X and Y) need to be supplied. These _coordinates may be in the units of the plotted data or in units which define the graphics window itself. ABOUT THE AUTHOR Arthur L. Carpenter has over fourteen years of experience as a statistician and data analyst and has served as a senior consultant with California Occidental Consultants, CALOXY, since 1983. His publications list includes a number of papers and posters presented at SUGI and he has developed and presented several courses and seminars on statistics and SAS programming. CAI.OXY offers SAS contract programming and in-house SAS training nationwide. AUTHOR ArthUr L. Carpenter California Occidental Consultants 4239 Serena Avenue Oceanside, CA 92056-5018 (619) 724-8579 REFERENCES SAS/GRAPH userls Guide, Release 6.03, SAS Institute, Inc., Cary, NC, USA. I Select a FUNCTION (Table 7.3) TRADEMARK INFORMATION II Select support variables (Table 7.3 and function text) III Select coordinate system and coordinate variables SAS and SAS/GRAPH trademarks of the SAS Cary, NC, USA. are registered Institute, Inc., 747