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

Similar documents
ODS/RTF Pagination Revisit

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

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

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

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

An Efficient Tool for Clinical Data Check

PharmaSUG Paper PO10

%Addval: A SAS Macro Which Completes the Cartesian Product of Dataset Observations for All Values of a Selected Set of Variables

Summary Table for Displaying Results of a Logistic Regression Analysis

PharmaSUG China Paper 059

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

PharmaSUG Paper SP04

Quality Control of Clinical Data Listings with Proc Compare

Indenting with Style

A Few Quick and Efficient Ways to Compare Data

PharmaSUG China Paper 70

Text Wrapping with Indentation for RTF Reports

Automated Checking Of Multiple Files Kathyayini Tappeta, Percept Pharma Services, Bridgewater, NJ

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

SAS (Statistical Analysis Software/System)

ABSTRACT INTRODUCTION MACRO. Paper RF

SAS (Statistical Analysis Software/System)

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

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

Setting Up Your Dissertation Format Using MS Word2000. Overview of the Process

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

PharmaSUG China 2018 Paper AD-62

PharmaSUG Paper PO12

When Powerful SAS Meets PowerShell TM

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

CitiDirect for Securities New Features February 2019

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

ODS TAGSETS - a Powerful Reporting Method

PharmaSUG Paper TT11

Data Quality Review for Missing Values and Outliers

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

Figure 1. Table shell

Validation Summary using SYSINFO

Producing Summary Tables in SAS Enterprise Guide

Chaining Logic in One Data Step Libing Shi, Ginny Rego Blue Cross Blue Shield of Massachusetts, Boston, MA

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

Automated Macros to Extract Data from the National (Nationwide) Inpatient Sample (NIS)

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

Summarizing Impossibly Large SAS Data Sets For the Data Warehouse Server Using Horizontal Summarization

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

CATEGORY SKILL SET REF. TASK ITEM

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

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

Let Hash SUMINC Count For You Joseph Hinson, Accenture Life Sciences, Berwyn, PA, USA

Step by step instructions for layout for Theology papers Part 1 Setting up margins

Countdown of the Top 10 Ways to Merge Data David Franklin, Independent Consultant, Litchfield, NH

SAS (Statistical Analysis Software/System)

%ANYTL: A Versatile Table/Listing Macro

Creating output datasets using SQL (Structured Query Language) only Andrii Stakhniv, Experis Clinical, Ukraine

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

CMISS the SAS Function You May Have Been MISSING Mira Shapiro, Analytic Designers LLC, Bethesda, MD

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

Using PROC REPORT to Cross-Tabulate Multiple Response Items Patrick Thornton, SRI International, Menlo Park, CA

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

Patricia Guldin, Merck & Co., Inc., Kenilworth, NJ USA

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

Bad Date: How to find true love with Partial Dates! Namrata Pokhrel, Accenture Life Sciences, Berwyn, PA

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

SAS Macros of Performing Look-Ahead and Look-Back Reads

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

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

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

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

A Macro to Keep Titles and Footnotes in One Place

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

Word processing software

Create Metadata Documentation using ExcelXP

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

Post-Processing.LST files to get what you want

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

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

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

ADVANCED WORD PROCESSING

Important Notice. Microsoft Word 2013 مهارات لقيادة الحاسوب. Tel: Fax: W:

PharmaSUG 2014 PO16. Category CDASH SDTM ADaM. Submission in standardized tabular form. Structure Flexible Rigid Flexible * No Yes Yes

An Alternate Way to Create the Standard SDTM Domains

Benchmark Macro %COMPARE Sreekanth Reddy Middela, MaxisIT Inc., Edison, NJ Venkata Sekhar Bhamidipati, Merck & Co., Inc.

Application Interface for executing a batch of SAS Programs and Checking Logs Sneha Sarmukadam, inventiv Health Clinical, Pune, India

Paper An Automated Reporting Macro to Create Cell Index An Enhanced Revisit. Shi-Tao Yeh, GlaxoSmithKline, King of Prussia, PA

The Implementation of Display Auto-Generation with Analysis Results Metadata Driven Method

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

Making an RTF file Out of a Text File, With SAS Paper CC13

Paper CT-16 Manage Hierarchical or Associated Data with the RETAIN Statement Alan R. Mann, Independent Consultant, Harpers Ferry, WV

MS Word 2010: Long Documents. Lesson Notes Author: Pamela Schmidt

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

BIRT Report Paging Feature Specification (BPS19)

A Macro to replace PROC REPORT!?

Virtual Accessing of a SAS Data Set Using OPEN, FETCH, and CLOSE Functions with %SYSFUNC and %DO Loops

Greenspace: A Macro to Improve a SAS Data Set Footprint

Appendix A Microsoft Office Specialist exam objectives

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

PharmaSUG Paper CC11

Get Started Writing SAS Macros Luisa Hartman, Jane Liao, Merck Sharp & Dohme Corp.

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

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

Transcription:

PharmaSUG 2015 - Paper QT40 Regaining Some Control Over ODS RTF Pagination When Using Proc Report Gary E. Moore, Moore Computing Services, Inc., Little Rock, Arkansas ABSTRACT When creating RTF files using SAS Proc Report, some of the control over pagination is lost because third party programs like Microsoft Word determine the pagination during rendering. Often, this pagination does not appear appropriate or esthetically pleasing. We can regain some of that control using the break option with Proc Report and manually setting page break points in the data. This requires an examination of RTF pagination while answering some questions about the data and report. What elements factor into the determination of pagination? What types of pagination are possible? What type of pagination is required? This paper examines these questions and provides a SAS Macro that will assist in manually setting break points for pagination. INTRODUCTION Because RTF pagination is done by third party programs like Microsoft Word at rendering, the default pagination can be unexpected and undesirable. It can be complicated even more with the customization of reports by the client. Some simple examples follow. THE PROBLEM Undesirable results can occur as in this example of a simple summarization table. Output 1. Undesirable results (12pt) 1

THE VARIABLES Report structure The number of available lines for the body of the report will vary based on numerous factors that involve the structure of the report. Among these are: 1. The font size of the report. 2. The number of title (header) and footer lines in the report. 3. The size of the columns and the column label length. Report Content The number of observations displayable on a given page of the report depends on the report structure and the available lines for the body of the report. But it will also depend on how many groups in the data are separated by blank lines on a given page and on the number of observations and number of variables that have flowed (wrapped) values within the columns on a given page. REPORT STRUCTURE FONT SIZE Larger font size will leave less room for the number of lines per page. Output 2. Large font (40pt) effect on available lines Smaller font size will leave more room for the number of lines per page. Output 3. Small font (12pt) effect on available lines 2

TITLES (HEADERS) AND FOOTERS The number of titles (headers) and footers will affect the available number of lines per page. Output 4. Titles (headers) and footers effect on available lines (12pt font) COLUMN SIZE AND COLUMN LABEL LENGTH The size of the columns and the column label length will affect the available number of lines per page. Output 5. Column size and Column label length effect on available lines (12pt font) 3

REPORT CONTENT SEPARATING GROUPS Separating groups in the data with blank lines will affect the number of observations on a given page. Output 6. Separating groups (12pt) effect on number of observations per given page FLOWED (WRAPPED) VALUES WITHIN COLUMNS The number of observations and variables that have flowed (wrapped) values within the columns will affect the number of observations on a given page. Because of the different ways Proc Report handles flowed variables, finding the best number for the length of the columns that works for the entire report can be an iterative process. Proc Report tries to split words in logical places, like spaces and punctuation. When it does this, it can use more lines than expected, particularly when there are many short words that do not use the entire column width. Output 7. Flowed (wrapped) values within columns (12pt) effect on number of observations per given page 4

REGAINING CONTROL After examination of issues that affect the behavior of pagination of RTF files, we can create a plan to control the behavior. Our plan of action is the creation of a paging macro (NextPage in Appendix) that addresses these issues and creates manual break points to be used with Proc Report and the break option. Because the pagination is determined during rendering, as the file is loaded and processed by Microsoft Word, handling these issues can be an iterative process. After looking at all of the factors that go into determining lines and observations per page, we can make a good guess as to the number of lines available and the number of characters available in the columns for flowed (wrapped) variables. But, it can be an iterative process to determine the correct number of lines and the correct column length that works for the entire report. MACRO NEXTPAGE %macro NextPage(indata=FINAL,byvars=,flowvars=,flowlens=, skipvars=,pagevars=,nlines=18,ngrps=,outdata=); PARAMETERS: 1. INDATA (Required) The input dataset name. Default = FINAL. 2. BYVARS (Optional) Sorting variables for report. 3. FLOWVARS (Optional) flowing variables for report. 4. FLOWLENS (Optional) column length needed for flowing variables. 5. SKIPVARS (Optional) skip variables for report; should be included in BYVARS. 6. PAGEVARS (Optional) page variables for report; should be included in BYVARS. 7. NLINES (Required) lines per page for body of report after counting for header, footnotes, and column labels. The default = 18. 8. OUTDATA (Required) The output dataset name for the report. The default = &INDATA. FUTURE ENHANCEMENT There are possibly better ways to estimate or control the flowing (wrapping) of text within columns (ref. MWSUG PO04-2011). There are some special features that we occasionally want to add to reports. It can be helpful to control the number of groups per page. Controlling the undesirable splitting of groups between pages (Widow Variables). When groups are split between pages adding a line that indicates it is continued from the previous page is nice. CONCLUSION The Microsoft Word pagination during rendering can create a loss of pagination control. But, after looking at the factors that determine this pagination, we can regain control by creating break points within the data prior to sending it to Proc Report. REFERENCES MWSUG PO04-2011 - Pagination in Clinical Trial PROC REPORT ODS - Chao Su, William Conover - NESUG 121 - Practical Solutions for Pagination, Indention, and Mixed-Text Alignment in ODS RTF Word Documents - Hui Song, PRA International, Horsham, PA 5

CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Name: Gary E. Moore Enterprise: Moore Computing Services, Inc. Address: 2006 Beckenham Cove City, State ZIP: Little Rock, AR 72212 Work Phone: 501-225-8689 E-mail: gary@moorecsi.net Web: www.moorecsi.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. 6

APPENDIX /**************************************************************************************** Macro that Estimates Pagination based on observations, levels, and flowing variables Created By : Gary Moore Moore Computing Services, Inc. 2006 Beckenham Cove Little Rock, AR 72212 501-225-8689 www.moorecsi.net Name : NextPage.sas PARAMETERS: 1. INDATA ---(Required) The input dataset name. Default = FINAL. 2. BYVARS ---(Optional) Sorting variables for report 3. FLOWVARS -(Optional) flowing variables for report 4. FLOWLENS -(Optional) column length needed for flowing variables 5. SKIPVARS -(Optional) skip variables for report; should be included in BYVARS 6. PAGEVARS -(Optional) page variables for report; should be included in BYVARS 7. NLINES ---(Required) lines per page for body of report after counting for header, footnotes, and column labels The default = 18. 8. OUTDATA --(Required) The output dataset name for the report The default = &INDATA. ****************************************************************************************/ %macro NextPage(indata=FINAL,byvars=,flowvars=,flowlens=,skipvars=,pagevars=,nlines=18,ngrps=,outdata=); options mprint; run; /* Number of FLOWVARS variables */ %let nflvs_=0; %if %length(&flowvars) > 0 %then %let nflvs_=%sysfunc(countw(&flowvars)); /* Number of FLOWLENS variables */ %let nflls_=0; %if %length(&flowlens) > 0 %then %let nflls_=%sysfunc(countw(&flowlens)); /* Number of SKIPVARS variables */ %let nskvs_=0; %if %length(&skipvars) > 0 %then %let nskvs_=%sysfunc(countw(&skipvars)); /* Number of PAGEVARS variables */ %let npgvs_=0; %if %length(&pagevars) > 0 %then %let npgvs_=%sysfunc(countw(&pagevars)); /* Dummy by variable */ data _indata; set &indata; byv_ = 1; run; %let byvars=byv_ &byvars; proc sort data=_indata; by &byvars; data _indata; set _indata; by &byvars; retain LINECNT PGBK 0; 7

/* Estimate number of lines needed for each flowed variable */ %if %length(&flowvars)>0 %then %do z_ = 1 %to &nflvs_; _len&z_ = 1; if %scan(&flowvars,&z_) ne ' ' then _len&z_ = ceil(length((%scan(&flowvars,&z_)))/%scan(&flowlens,&z_)); %end; /* Increment line count by 1 or by max of all needed flow variable lines */ LINECNT = LINECNT + max( %if %length(&flowvars)>0 %then %do z_ = 1 %to &nflvs_; _len&z_, %end; 1); /* Increment line count for each skip variable */ %if %length(&skipvars)>0 %then %do z_ = 1 %to &nskvs_; if first.%scan(&skipvars,&z_) then LINECNT = LINECNT + 1; %end; /* Increment page count by 1 each time we use up the lines per page and for each page variable */ if %if %length(&pagevars)>0 %then %do z_ = 1 %to &npgvs_; first.%scan(&pagevars,&z_)or %end; LINECNT >= &nlines then do; PGBK = PGBK+1; LINECNT=0; end; run; %if %length(&outdata)=0 %then %let outdata=&indata; data &outdata; set _indata(drop=(linecnt _len:)); run; %mend NextPage; 8