PharmaSUG 2013 CC26 Automating the Labeling of X- Axis Sanjiv Ramalingam, Vertex Pharmaceuticals, Inc., Cambridge, MA

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

Keeping Track of Database Changes During Database Lock

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

Creating Forest Plots Using SAS/GRAPH and the Annotate Facility

Sorting big datasets. Do we really need it? Daniil Shliakhov, Experis Clinical, Kharkiv, Ukraine

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

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

PharmaSUG Paper CC02

A Macro to Create Program Inventory for Analysis Data Reviewer s Guide Xianhua (Allen) Zeng, PAREXEL International, Shanghai, China

A Generalized Procedure to Create SAS /Graph Error Bar Plots

A SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY

An Efficient Method to Create Titles for Multiple Clinical Reports Using Proc Format within A Do Loop Youying Yu, PharmaNet/i3, West Chester, Ohio

How to Keep Multiple Formats in One Variable after Transpose Mindy Wang

CC13 An Automatic Process to Compare Files. Simon Lin, Merck & Co., Inc., Rahway, NJ Huei-Ling Chen, Merck & Co., Inc., Rahway, NJ

PharmaSUG China. Systematically Reordering Axis Major Tick Values in SAS Graph Brian Shen, PPDI, ShangHai

Create a Format from a SAS Data Set Ruth Marisol Rivera, i3 Statprobe, Mexico City, Mexico

PharmaSUG Paper PO12

Create Flowcharts Using Annotate Facility. Priya Saradha & Gurubaran Veeravel

Missing Pages Report. David Gray, PPD, Austin, TX Zhuo Chen, PPD, Austin, TX

Submitting SAS Code On The Side

A Tool to Compare Different Data Transfers Jun Wang, FMD K&L, Inc., Nanjing, China

PharmaSUG China Paper 059

Reproducibly Random Values William Garner, Gilead Sciences, Inc., Foster City, CA Ting Bai, Gilead Sciences, Inc., Foster City, CA

Regaining Some Control Over ODS RTF Pagination When Using Proc Report Gary E. Moore, Moore Computing Services, Inc., Little Rock, Arkansas

Have SAS Annotate your Blank CRF for you! Plus dynamically add color and style to your annotations. Steven Black, Agility-Clinical Inc.

PharmaSUG DS05

Checking for Duplicates Wendi L. Wright

Taming a Spreadsheet Importation Monster

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

PharmaSUG Paper PO10

INTRODUCTION TO THE SAS ANNOTATE FACILITY

An Efficient Tool for Clinical Data Check

Paper HOW-06. Tricia Aanderud, And Data Inc, Raleigh, NC

Data Edit-checks Integration using ODS Tagset Niraj J. Pandya, Element Technologies Inc., NJ Vinodh Paida, Impressive Systems Inc.

Quick and Efficient Way to Check the Transferred Data Divyaja Padamati, Eliassen Group Inc., North Carolina.

A Format to Make the _TYPE_ Field of PROC MEANS Easier to Interpret Matt Pettis, Thomson West, Eagan, MN

An Introduction to Visit Window Challenges and Solutions

What Do You Mean My CSV Doesn t Match My SAS Dataset?

PharmaSUG 2012 Paper CC13

PharmaSUG Paper TT11

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

Validation Summary using SYSINFO

Give me EVERYTHING! A macro to combine the CONTENTS procedure output and formats. Lynn Mullins, PPD, Cincinnati, Ohio

A Breeze through SAS options to Enter a Zero-filled row Kajal Tahiliani, ICON Clinical Research, Warrington, PA

Multiple Forest Plots and the SAS System

The Path To Treatment Pathways Tracee Vinson-Sorrentino, IMS Health, Plymouth Meeting, PA

ABC Macro and Performance Chart with Benchmarks Annotation

Clip Extreme Values for a More Readable Box Plot Mary Rose Sibayan, PPD, Manila, Philippines Thea Arianna Valerio, PPD, Manila, Philippines

The Dataset Diet How to transform short and fat into long and thin

A Macro to Keep Titles and Footnotes in One Place

Ditch the Data Memo: Using Macro Variables and Outer Union Corresponding in PROC SQL to Create Data Set Summary Tables Andrea Shane MDRC, Oakland, CA

SAS Programming Techniques for Manipulating Metadata on the Database Level Chris Speck, PAREXEL International, Durham, NC

Breaking up (Axes) Isn t Hard to Do: An Updated Macro for Choosing Axis Breaks

PharmaSUG Paper AD06

Useful Tips When Deploying SAS Code in a Production Environment

Presentation Quality Graphics with SAS/GRAPH

T.I.P.S. (Techniques and Information for Programming in SAS )

Streamline Table Lookup by Embedding HASH in FCMP Qing Liu, Eli Lilly & Company, Shanghai, China

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

ABSTRACT INTRODUCTION MACRO. Paper RF

Omitting Records with Invalid Default Values

To conceptualize the process, the table below shows the highly correlated covariates in descending order of their R statistic.

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

Using GSUBMIT command to customize the interface in SAS Xin Wang, Fountain Medical Technology Co., ltd, Nanjing, China

Automating Comparison of Multiple Datasets Sandeep Kottam, Remx IT, King of Prussia, PA

Run your reports through that last loop to standardize the presentation attributes

Creating Macro Calls using Proc Freq

SAS Macro Dynamics: from Simple Basics to Powerful Invocations Rick Andrews, Office of Research, Development, and Information, Baltimore, MD

Easy CSR In-Text Table Automation, Oh My

Displaying Multiple Graphs to Quickly Assess Patient Data Trends

PharmaSUG Paper BB01

Your Own SAS Macros Are as Powerful as You Are Ingenious

Fly over, drill down, and explore

Macro Quoting: Which Function Should We Use? Pengfei Guo, MSD R&D (China) Co., Ltd., Shanghai, China

Converting Annotate to ODS Graphics. Is It Possible?

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

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

Macro to compute best transform variable for the model

PharmaSUG Paper CC11

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

A Macro that can Search and Replace String in your SAS Programs

Quick Data Definitions Using SQL, REPORT and PRINT Procedures Bradford J. Danner, PharmaNet/i3, Tennessee

Clinical Data Visualization using TIBCO Spotfire and SAS

A Macro for Systematic Treatment of Special Values in Weight of Evidence Variable Transformation Chaoxian Cai, Automated Financial Systems, Exton, PA

ABSTRACT INTRODUCTION TRICK 1: CHOOSE THE BEST METHOD TO CREATE MACRO VARIABLES

One Project, Two Teams: The Unblind Leading the Blind

Data Quality Review for Missing Values and Outliers

Journey to the center of the earth Deep understanding of SAS language processing mechanism Di Chen, SAS Beijing R&D, Beijing, China

Two useful macros to nudge SAS to serve you

Get SAS sy with PROC SQL Amie Bissonett, Pharmanet/i3, Minneapolis, MN

Making the most of SAS Jobs in LSAF

%MAKE_IT_COUNT: An Example Macro for Dynamic Table Programming Britney Gilbert, Juniper Tree Consulting, Porter, Oklahoma

Not Just Merge - Complex Derivation Made Easy by Hash Object

PharmaSUG China Paper 70

When Powerful SAS Meets PowerShell TM

SAS Macro Technique for Embedding and Using Metadata in Web Pages. DataCeutics, Inc., Pottstown, PA

SAS 9 Programming Enhancements Marje Fecht, Prowerk Consulting Ltd Mississauga, Ontario, Canada

SAS Application to Automate a Comprehensive Review of DEFINE and All of its Components

SAS Graphs in Small Multiples Andrea Wainwright-Zimmerman, Capital One, Richmond, VA

An Alternate Way to Create the Standard SDTM Domains

Transcription:

PharmaSUG 2013 CC26 Automating the Labeling of X- Axis Sanjiv Ramalingam, Vertex Pharmaceuticals, Inc., Cambridge, MA ABSTRACT Labeling of the X-axis usually involves a tedious axis statement specifying tick marks and typing labels for each of the time points. A methodology to implement and automate the generation of the axis statement for X-axis labeling with real time representation of the X-axis is discussed. INTRODUCTION Creating customized labels for the X-axis usually involves creating a value format or specifying the labels within the axis statement. The paper proposes another methodology where in the visit numbers (numeric variable), their respective labels (character variable) are already present in the input dataset. This information is then used to automate the creation of the labels. AVISITN 0 D1 1 2 3 D2 4 D3 AVISIT Figure 1. Illustration of structure of a typical input dataset used to automate labeling. Note that no label exists when AVISITN equals 1 or 2. 0.4 0.2 D1 D2 D3 Figure 2. Illustration of how labeling appears in the X-axis when the algorithm is implemented. Note that though tick marks are created when AVISITN equals 1 or 2 no labels are created. 1

METHODOLOGY Automating the labeling of X-axis involves dynamically creating two different formats. The first format is a value format that is created for a unique combination of visits (numeric) and their labels. i.e. Proc Format VALUE val_fmt 0= D1 2= D2 The second format is a picture format created to insert blank labels for visit labels that are not unique. i.e. Proc Format PICTURE pic_fmt 1= 3= The picture format is recommended because the value format cannot be used to create blank labels. Use of value format results in an apostrphe ( ) instead of blanks. Dynamic creation of the formats involves creating a string/text of the required statement and the use of PROC SQL to combine all the string/text and convert them into a single macro variable. Two major steps are involved. In the first step, a text/string of the required code is created.this can be implemented using the concatenation operator. Assuming that for each unique combination of visit numbers and their labels that is contained in a dataset, a text string that is basically an assignment statement for each of the visits needs to be created. E.g. To create a statement 0= D1 where 0 is the visit number (avisitn) and D1 is the corresponding label (avisit) and to store it in a variable by name val_fmt, val_fmt=strip(put(avisitn,best.)) strip("='") strip(avisit) strip("'") It is then required to make all the records of the variable of interest(val_fmt ) into one macro variable using PROC SQL. proc sql select val_fmt /* Variable of interest */ into :val_fmt separated by ' ' /* Macro variable to be created */ from val_fmt /* Source dataset */ quit 2

The step by step procedure to create such a graph of interest is as follows: STEP 1 The macro variables required are first initialized. STEP 2 /* Input/Source dataset */ %let inds=srcds /* Numeric Visit Variable */ %let visitn =avisitn /* Character Visit Variable that contains label name for Visit*/ %let visit =avisit /* Order/Space between visits Typical in behavior compared to the by option within the axis statement */ %let visitn =avisitn /* Maximum value of visit */ %let max_dmy=20 /* Maximum value of visit */ %let min_dmy=0 The input dataset is used to get the unique combination of visits and their respective labels. Two datasets are created one for value-format and another for picture-format. Records that do not have a unique combination of visit labels are output to the picture-format dataset. The required string/text statements are also created. STEP 3 proc sort data=&inds nodupkey out=temp1(keep=&visitn &visit) by &visit &visitn data val_fmt pic_fmt1 length pic_fmt $15 val_fmt $50 set temp1 by &visit if not first.&visit then do &visit=" " pic_fmt=strip(put(&visitn,best.)) strip("=") strip('" " ' ) output pic_fmt1 end else do val_fmt=strip(put(&visitn,best.)) strip("='") strip(&visit) strip("'") output val_fmt end If the ordering between the visits is not even then it is required to generate a dummy sequence to create blank labels. This also allows for real time representation of the X-Axis. data temp2 do i=&min_dmy to &max_dmy by &spvisit &visitn=i output end 3

STEP 4 A picture format needs to be assigned to all values that are not there in parent dataset. STEP 5 proc sort data=temp1 by &visitn &visit data pic_fmt2 length pic_fmt $15 merge temp2(in=a) temp1(in=b) by &visitn if a and not b then do pic_fmt=strip(put(&visitn,best.)) strip("=") strip('" " ' ) output end /* final picture format dataset */ data pic_fmt set pic_fmt1 pic_fmt2 Macro Variables for each of the formats are then created. In certain cases a picture format may not be required at all. In such cases the macro variable for picture format is created only if the observations in the picture format dataset pic_fmt is greater than zero. proc sql select val_fmt into:val_fmt separated by ' ' from val_fmt quit proc sql noprint select count(*) into :OBSCOUNT from pic_fmt quit %macro chkobs() %if %eval(&obscount gt 0) %then %do proc sql select pic_fmt into:pic_fmt separated by ' ' from pic_fmt quit proc format value val_fmt &val_fmt other=[pic_fmt.] picture pic_fmt &pic_fmt %end 4

%if %eval(&obscount eq 0) %then %do proc format value val_fmt &val_fmt %end %mend %chkobs The dynamically created format can then be invoked in the graphical procedure statements such as a GPLOT as a simple format statement. e.g. format avisitn val_fmt. STEP 6 To dynamically create customized tick marks the annotate facility in combination with the GANNOMAC feature can be used to dynamically place tick marks by creating the required annotate dataset. CONCLUSION /* V_min Minimum Y-value in the Source Dataset */ %let v_min=0 data anno_tick length when $1 retain when 'a' set temp1 xsys='2' ysys='2' %label(&visitn, &v_min, "I", black, 0, 0, 0.5,arial,8) A methodology to automate the creation of X axis labels has been explained. To further automate, the source dataset can be used to determine the maximum (max_dmy) and minimum (min_dmy) values using the PROC MEANS procedure. CONTACT INFORMATION Your comments and questions are valued and encouraged. Please contact the author at: Name: Sanjiv Ramalingam Enterprise: Vertex Pharmaceuticals, Inc. Address: 130 Waverly Street City, State, ZIP: Cambridge, MA 02139 Email : sanjiv_ramalingam@vrtx.com 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. Other brand and product names are trademarks of their respective companies. 5