IT S THE LINES PER PAGE THAT COUNTS Jonathan Squire, C2RA, Cambridge, MA Johnny Tai, Comsys, Portage, MI

Similar documents
Presentation Quality Bulleted Lists Using ODS in SAS 9.2. Karl M. Kilgore, PhD, Cetus Group, LLC, Timonium, MD

ODS/RTF Pagination Revisit

ODS for PRINT, REPORT and TABULATE

Formatting Highly Detailed Reports: Eye-Friendly, Insight-Facilitating

Tips and Tricks to Create In-text Tables in Clinical Trial Repor6ng Using SAS

Indenting with Style

Paper PO07. %RiTEN. Duong Tran, Independent Consultant, London, Great Britain

This paper describes a report layout for reporting adverse events by study consumption pattern and explains its programming aspects.

Practically Perfect Presentations Cynthia L. Zender, SAS Institute, Inc., Cary, NC

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

My Reporting Requires a Full Staff Help!

A Practical and Efficient Approach in Generating AE (Adverse Events) Tables within a Clinical Study Environment

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

An Introduction to PROC REPORT

Square Peg, Square Hole Getting Tables to Fit on Slides in the ODS Destination for PowerPoint

Macros for creating a custom report of figures

Table 1 in Scientific Manuscripts; Using PROC REPORT and the ODS System Carter Sevick, DoD Center for Deployment Health Research, San Diego, CA

Compute; Your Future with Proc Report

DESCRIPTION OF THE PROJECT

And Now, Presenting... Turn the Tables on Boring Reports with SAS 9.2 and RTF Tagset Options Louise S. Hadden, Abt Associates Inc.

Text Wrapping with Indentation for RTF Reports

ODS DOCUMENT, a practical example. Ruurd Bennink, OCS Consulting B.V., s-hertogenbosch, the Netherlands

footnote1 height=8pt j=l "(Rev. &sysdate)" j=c "{\b\ Page}{\field{\*\fldinst {\b\i PAGE}}}";

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

How To Get Ten Pounds Of Data Into A Five Pound Can Using Flyover Technique In HTML Output

Prove QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC

Producing Summary Tables in SAS Enterprise Guide

Essential ODS Techniques for Creating Reports in PDF Patrick Thornton, SRI International, Menlo Park, CA

Paper SIB-096. Richard A. DeVenezia, Independent Consultant, Remsen, NY

FILE TYPES & SIZES BOOK COVER

%ANYTL: A Versatile Table/Listing Macro

Combining the Results from Multiple SAS PROCS into a Publication Quality Table

Pros and Cons of Interactive SAS Mode vs. Batch Mode Irina Walsh, ClinOps, LLC, San Francisco, CA

A Fully Automated Approach to Concatenate RTF outputs and Create TOC Zhiping Yan, Covance, Beijing, China Lugang Xie, Merck, Princeton, US

General Methods to Use Special Characters Dennis Gianneschi, Amgen Inc., Thousand Oaks, CA

PharmaSUG China 2018 Paper AD-62

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

A Few Quick and Efficient Ways to Compare Data

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

A Macro to Manage Table Templates Mark Mihalyo, Community Care Behavioral Health Organization, Pittsburgh, PA

HAVE YOU EVER WISHED THAT YOU DO NOT NEED TO TYPE OR CHANGE REPORT NUMBERS AND TITLES IN YOUR SAS PROGRAMS?

Overview 14 Table Definitions and Style Definitions 16 Output Objects and Output Destinations 18 ODS References and Resources 20

INTRODUCTION THE FILENAME STATEMENT CAPTURING THE PROGRAM CODE

HTML for the SAS Programmer

Making a SYLK file from SAS data. Another way to Excel using SAS

CATEGORY SKILL SET REF. TASK ITEM

Formatting a Report with Word 2010

QUERIES BY ODS BEGINNERS. Varsha C. Shah, Dept. of Biostatistics, UNC-CH, Chapel Hill, NC

Manipulating Statistical and Other Procedure Output to Get the Results That You Need

Document Formatting and Page Layout

Word processing software

A Patient Profile Using ODS RTF PhilaSUG Spring Terek Peterson, MBA June 17, 2004

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

The REPORT Procedure CHAPTER 32

SESUG Paper RIV An Obvious Yet Helpful Guide to Developing Recurring Reports in SAS. Rachel Straney, University of Central Florida

Multi-sheet Workbooks from SAS. data using the ODS ExcelXP tagset. Another Way to EXCEL using SAS

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

ODS TAGSETS - a Powerful Reporting Method

ABSTRACT MORE THAN SYNTAX ORGANIZE YOUR WORK THE SAS ENTERPRISE GUIDE PROJECT. Paper 50-30

How to Create a Custom Style

All Aboard! Next Stop is the Destination Excel

Figure 1. Table shell

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

From Clicking to Coding: Using ODS Graphics Designer as a Tool to Learn Graph Template Language

Data Presentation. Paper

The Great Escape(char) Louise S. Hadden, Abt Associates Inc., Cambridge, MA

Easing into Data Exploration, Reporting, and Analytics Using SAS Enterprise Guide

Word 2016: Core Document Creation, Collaboration and Communication; Exam

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

Cambridge International Examinations Cambridge International General Certificate of Secondary Education

Smooth Writing with In-Line Formatting Louise S. Hadden, Abt Associates Inc., Cambridge, MA

The REPORT Procedure: A Primer for the Compute Block

Portage Northern High School Computer Applications * Microsoft Office 2010 Course Syllabus Mrs. Meyer

Cambridge International Examinations Cambridge International General Certificate of Secondary Education

A Way to Work with Invoice Files in SAS

Greenspace: A Macro to Improve a SAS Data Set Footprint

Microsoft Access II 1.) Opening a Saved Database Music Click the Options Enable this Content Click OK. *

TLFs: Replaying Rather than Appending William Coar, Axio Research, Seattle, WA

Using Templates Created by the SAS/STAT Procedures

PharmaSUG China. model to include all potential prognostic factors and exploratory variables, 2) select covariates which are significant at

Print the Proc Report and Have It on My Desktop in the Morning! James T. Kardasis, J.T.K. & Associates, Skokie, IL

SAS (Statistical Analysis Software/System)

Line Spacing and Double Spacing...24 Finding and Replacing Text...24 Inserting or Linking Graphics...25 Wrapping Text Around Graphics...

SAS (Statistical Analysis Software/System)

Paper # Jazz it up a Little with Formats. Brian Bee, The Knowledge Warehouse Ltd

Data Presentation ABSTRACT

Perceptive Document Composition

ICT IGCSE Practical Revision Presentation Word Processing

Reports User Guide. PowerSchool Student Information System

Personal Computing EN1301 Word Processing Applications (12 hrs.) Part All rights reserved by UCSC

Enjoy Microsoft Excel 2007 for Novice Users Author: Christine Kent Web address Blog address address

Creating Multi-Sheet Excel Workbooks the Easy Way with SAS Vincent DelGobbo, SAS Institute Inc., Cary, NC

Creating a Patient Profile using CDISC SDTM Marc Desgrousilliers, Clinovo, Sunnyvale, CA Romain Miralles, Clinovo, Sunnyvale, CA

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

An Efficient Tool for Clinical Data Check

3N Validation to Validate PROC COMPARE Output

Post-Processing.LST files to get what you want

0418 INFORMATION TECHNOLOGY

SAMPLE PAPER FOR AN IGBR JOURNAL OR PROCEEDINGS PUBLICATION

Graduate Health Sciences Word Topics

Transcription:

IT S THE LINES PER PAGE THAT COUNTS Jonathan Squire, C2RA, Cambridge, MA Johnny Tai, Comsys, Portage, MI ABSTRACT When the bodytitle option is used to keep titles and footnotes independent of the table body, a line counter and page break variable must be manually programmed. We present a method of dynamically adjusting each page to fit the maximum number of lines, adjusting for titles, footnotes, column headers, and text strings that wrap onto multiple lines. As the text wrapping is dependent on font size, we present an efficient way to size up each character. Theis issue is geared for intermediate to advanced programmers with some ODS and SAS/MACRO familiarity. INTRODUCTION At the drug development company I am currently working with, we use Proc Report to create RTF output for our tables and listings. Some of these tables are very long, and all have several titles and footnotes. We sought a method to overcome the lack of page break control when the bodytitle option is used. ODS BEHAVIOR With the default ODS destination is selected, titles & footnotes (TF) are written into the headers and footers. When creating a Clinical Study Report in the biotechnology/pharmaceutical industry, many such outputs are routinely inserted into a Microsoft Word document that itself has section breaks and TFs. Word gets very confused as the header and footer information from the SAS output conflict with the global headers and footers in the parent document. An easy solution is to add the bodytitle option to the ODS statement. Then, TFs are treated as separate objects, like the body of the output, and are not written into the Word headers and footers, and thus do not interfere with section breaks and global titles and footnotes when inserted into a bigger document. But you pay a price: if the default date/time stamp & page number options are both turned off via options nodate nonumber, no errors will occur, but the document cannot be opened. That can sure cause some serious head scratching! There is a way around that: turn the date off and the page on, but make the color of the page number white, so it will be invisible. You can do this via your ODS style template, used to customize the general look and feel of all ODS destinations, using the code within a code of PROC TEMPLATE: style pageno from titlesandfooters /foreground=white font_size=6pt; But a more serious problem occurs when bodytitle is used with multi-page output: the body of the output is treated as one long page. No footnotes appear at the bottom of page 1 and no titles occur at the top of page 2! This behavior took more time to solve. Our solution was to write a fairly complex macro that reads in the RTF file, and based on the RTF codes, determine which part was the table body, titles, and footnotes. The output is then reconstituted, adding the titles and footnotes on every page. Perhaps more details in a separate paper someday! PAGE BREAKS Since the output was reformatted by this macro, the page break logic needed to be added manually. One method to for creating the page breaks was simple, but primitive and error prone. We would use code such as: if mod(_n_,7)=0 then page+1; meaning write a new page after 7 lines of data. This number would be arrived at through trial and error. We would start with a high number, then page through the output, looking for bad page breaks, then we would reduce the number of lines per page and repeat until no orphan pages with only a footnote were found. Not only is this method primitive, but it also wastes a lot of white space via this least common denominator approach, and with outputs of hundreds of pages, this method became time consuming and error-prone (for those too lazy to check every page). See below for an example of output created by this method. 1

Figure 1: AE table output using the primitive method So we created a macro that would dynamically determine the maximum lines per page that would fit after adjusting for titles, column headers, lines that wrap onto a new line, and footnotes. This method had the added advantage of not wasting white space, resulting in fewer pages in the output. DESCRIPTION OF THE PROGRAM With that introduction, now we can discuss how this program works. To determine if a text field would wrap onto a new line, we needed to find out the width of all characters in all the fonts used on our reports, which is Arial 9, 10, or 11 pt. The web site http://www3.sympatico.ca/chris.lamoureux2/ is where the True Type Explorer application can be installed that will tell you the width of every character by font type. However, this width is not in a known unit. For each font size, we can then determine the factor to convert from this width to the cellwidth unit used by Proc Report by determining how many characters of a given width fit into a known cell width column for a given font size. For example, drilling down in the True Type Explorer you will discover the width of the letter e is 1139. Since there are only about 20 unique widths, the width per character can be assigned in a format statement, and the point size determined by multiplying this width by the font size factor: proc format; value $ pts "'"=455 "i","j","l"=455 " "=532 2

"!",",",".","/",":",";","[","\","]","f","i"," ","t"=569 "-","(",")","r"=682 "{","}"=684 '"'=684 "*"=797 "^"=961 "c","j","k","s","v","x","y","z"=1024 "#","$","?","_","0","1","2","3","4","5","6","7","8","9","a", "b","d","e","g","h","l","n","o","p","q","u"=1139 "~","+","<","=",">"=1196 "F","T","Z"=1251 " ","&","A","B","E","K","P","S","V","X","Y"=1366 "C","D","H","N","R","U","w"=1479 "G","O","Q"=1593 "M","m"=1706 "%"=1821 "W"=1933 "@"=2079; We then sum the cellwidths of each character in the record and compare that to the cellwidth specified by the user. We can then determine when a line will wrap, and adjust the line counter accordingly based on the number of lines that will fit on each page adjusting for wrapping, break variables, margins, titles and footnotes. The parameters input to the macro are: inds: name of input dataset (required) outds: name of output dataset lbls: number of lines used for the column labels (required) fontsize: font size of the table body as in the rtf file, can only be Arial 9pt, 10pt or 11pt, default to Arial font size 10 lbvar1: name of a line break variable set, E.g., to account for a line break after aesoc, aesoc would be passed (optional) wvar1-4: name of the variable that will be wrapped, up to 4 variables (at least 1 variable/width set is required) cellw1-4: cellwidth as defined in PROC REPORT for the corresponding variable, up to the number of wrap variables specified A sample call to the macro is: %getpage(inds=final, outds=final, lbvar1=aesoc aept, fontsize=11, lbls=6, wvar1=vartext,cellw1=120 ); Based on the cell width and font size specified, the total width in units of points that can fit within the column is determined. Then the width of each character to be written in the column is summed. If the total character width exceeds the fittable width as specified by the user, the number of lines left to print on the page is decreased by one. The margin, titles, and footnotes are also taken into account. Here is sample Proc Report code, note the page variable that is used to produce page breaks: options orientation=landscape; ods rtf file="&tab_out.&fwithnum..rtf" style =Amgen.Styles.LandscapeLetterFS10 bodytitle; proc report data = final missing nowindows split = "#" style(report) = [rules = groups cellspacing = 0 cellpadding = 1pt] style(column) = [protectspecialchars = off asis=on]; column page order aesoc order2 aept sevline vartext ("Dose Cohort (mg)" cntpct1-cntpct7) cntpct8; define page / order noprint; define order / order noprint; define aesoc / order noprint; define order2 / order noprint; 3

define aept / order noprint; define sevline / order noprint; define vartext / display "System Organ Class#Preferred Term" width=25 flow left style(column)=[asis=on] style = {cellwidth = 120 pt vjust=b}; define cntpct1 / display "GRP 1#(N = &n1)# #n (%)" center define cntpct2 / display "GRP 2#(N = &n2)# #n (%)" center define cntpct3 / display "GRP 3#(N = &n3)# #n (%)" center define cntpct4 / display "GRP 4#(N = &n4)# #n (%)" center define cntpct5 / display "GRP 5#(N = &n5)# #n (%)" center define cntpct6 / display "GRP 6#(N = &n6)# #n (%)" center define cntpct7 / display "GRP 7#(N = &n7)# #n (%)" center define cntpct8 / display "All#(N = &n8)# #n (%)" center break after page/page; compute before aept; line @1 " "; endcomp; ods rtf close; * Call the macro that assures the titles and footnotes are on every page; %edit_rtf; Figure 2 shows the same report, but using the %getpage macro, the page breaks are determined dynamically, and more lines can fit on most pages, as noted in bold: Figure 2: AE table output using the %getpage method 4

LIMITATIONS The macro is not currently designed for: - output with a portrait orientation. - output containing any repeating text,such as ID text strings in a subject level listing. CONCLUSIONS The lack of page break support when the bodytitle option is used in SAS version 8 or 9 can be overcome by use of a macro that adds the titles and footers back onto each page (not discussed here), and another macro that counts the available lines per page and creates page breaks accordingly. The macro leverages information of the width of each character based on the online application True Type Explorer and uses that information to determine if a line will wrap onto the next page. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Jonathan Squire 1615 9 th St Berkeley CA 94710 Work Phone: (510) 525-1610 Email: jonsquir@comcast.net 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