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

Similar documents
ODS for PRINT, REPORT and TABULATE

Innovative Graph for Comparing Central Tendencies and Spread at a Glance

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

SAS Survey Report Macro for Creating User-Friendly Descriptive Summaries

Figure 1. Table shell

CHAPTER 7 Using Other SAS Software Products

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

Art Carpenter California Occidental Consultants

Indenting with Style

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

The REPORT Procedure CHAPTER 32

Using PROC TABULATE and ODS Style Options to Make Really Great Tables Wendi L. Wright, CTB / McGraw-Hill, Harrisburg, PA

Writing Reports with the

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

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

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

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

ABSTRACT INTRODUCTION MACRO. Paper RF

Part 1. Getting Started. Chapter 1 Creating a Simple Report 3. Chapter 2 PROC REPORT: An Introduction 13. Chapter 3 Creating Breaks 57

The Fantastic Four: Running Your Report Using the TABULATE, TRANSPOSE, REPORT, or SQL Procedure

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

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

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

A Dynamic Imagemap Generator Carol Martell, Highway Safety Research Center, Chapel Hill, NC

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

RWI not REI a Robust report writing tool for your toughest mountaineering challenges.

WYSIWYG Editor: Users Manual

Christopher Toppe, Ph.D. Computer Sciences Corporation

Quick Results with the Output Delivery System

Paper Abstract. Introduction. SAS Version 7/8 Web Tools. Using ODS to Create HTML Formatted Output. Background

International Studies Association Table Preparation Guidelines

Word Template Instructions

MS WORD. You can use it for writing letters, reports and so on.

ET01. LIBNAME libref <engine-name> <physical-file-name> <libname-options>; <SAS Code> LIBNAME libref CLEAR;

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

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

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

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

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

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

Table of Contents. Word. Using the mouse wheel 39 Moving the insertion point using the keyboard 40 Resume reading 41

Formatting documents in Microsoft Word Using a Windows Operating System

Quick Start Guide. Version R94. English

Libre Writer Exercise - 4

Assessing superiority/futility in a clinical trial: from multiplicity to simplicity with SAS

ODS in an Instant! Bernadette H. Johnson, The Blaze Group, Inc., Raleigh, NC

Co. Cavan VEC. Co. Cavan VEC. Programme Module for. Word Processing. leading to. Level 5 FETAC. Word Processing 5N1358. Word Processing 5N1358

ODS/RTF Pagination Revisit

OU EDUCATE TRAINING MANUAL

How to Create a Custom Style

Part 1. Introduction. Chapter 1 Why Use ODS? 3. Chapter 2 ODS Basics 13

Create a new document based on default template, other available template like: memo, fax, agenda.

Macros for creating a custom report of figures

Lava New Media s CMS. Documentation Page 1

ABSTRACT INTRODUCTION

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

Enhancing SAS Output Tables with WordPerfect

Go Ahead and _BREAK_-down: Advanced COMPUTE Block Examples

The City School PECHS Junior Boys 1 st Term Comprehensive Worksheet (Creating a Document)

Paper CC-016. METHODOLOGY Suppose the data structure with m missing values for the row indices i=n-m+1,,n can be re-expressed by

APPENDIX THE TOOLBAR. File Functions

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

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

Microsoft Word Tutorial

Running head: WORD 2007 AND FORMATING APA PAPERS 1. A Brief Guide to using Word 2007 to Format Papers in the Publication Style of the American

The American University in Cairo. Academic Computing Services. Word prepared by. Soumaia Ahmed Al Ayyat

SOUTHWEST DECISION SCIENCES INSTITUTE INSTRUCTIONS FOR PREPARING PROCEEDINGS

Quick Access Toolbar. You click on it to see these options: New, Open, Save, Save As, Print, Prepare, Send, Publish and Close.

Essentials of the SAS Output Delivery System (ODS)

San Pedro Junior College. WORD PROCESSING (Microsoft Word 2016) Week 4-7

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

Colliery Task (Word 2007) Module 3 Word Processing (Word 2007)

Creating a new form with check boxes, drop-down list boxes, and text box fill-ins. Customizing each of the three form fields.

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

Microsoft Word 2010 Basics

Beginning Tutorials. A Beginner's Guide to Incorporating SAS Output in Microsoft Office Applications Vincent DelGobbo, SAS Institute Inc.

Zeppelin Website Content Manager User Manual

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

DOING MORE WITH WORD: MICROSOFT OFFICE 2010

Microsoft Word Part 3 Office 2013

Formatting a Report with Word 2010

The same can also be achieved by clicking on Format Character and then selecting an option from the Typeface list box.

eschoolplus+ Cognos Query Studio Training Guide Version 2.4

COMPUTER APPLICATIONS TECHNOLOGY

AASHTO Materials Standard Template Users Guide

Acadia Psychology Thesis Template Guide

The REPORT Procedure: A Primer for the Compute Block

Word processing software

Microsoft Word 2007 on Windows

Identifying Duplicate Variables in a SAS Data Set

Keynote 08 Basics Website:

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University : Advanced Applications of MS-Office

The FORMS Procedure. Overview CHAPTER 20

USING DATA TO SET MACRO PARAMETERS

Getting Started Guide. Chapter 3 Using Styles and Templates

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

APPENDIX F CODING FOR PUP

Teacher Activity: page 1/9 Mathematical Expressions in Microsoft Word

WORD XP/2002 USER GUIDE. Task- Formatting a Document in Word 2002

CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 2 TEXT FORMATTING

Transcription:

QUERIES BY ODS BEGINNERS Varsha C. Shah, Dept. of Biostatistics, UNC-CH, Chapel Hill, NC ABSTRACT This paper presents a list of questions often asked by those initially experimenting with ODS output. Why might questions arise? One could be converting from Version 6 or simply trying to improve the appearance of output. Also, often the same results can be achieved in several different ways, and a novice might wonder about this. Here, an attempt is made to answer some common questions in as simple a way as possible, one thing at a time. It is assumed that after getting to know the basics, the reader will experiment with combinations of ODS features to achieve the desired output appearance. To keep things simple, neither templates nor ODS styles are introduced. Also, it is worth mentioning that future versions of SAS will make some of the features described here available more conveniently. This work was done with Version 8.2. INTRODUCTION ODS is full of surprises. It creates what was not possible with simple listings, but some additional things come along which the programmer may want to deal with. The illustrations are based on randomly generated data. The discussion is limited to two procedures commonly used when attractive output is desired, namely PROC REPORT and PROC TABULATE. Most of the features are common to both procedures. The SAS program and results are included in the appendix. The options or statements required for the desired changes in the output are highlighted in light gray. Each affected statement is followed by a dark square indicating the question numbers addressed, from the following list of commonly recurring questions at my organization: Q1 How can I change the fonts of titles and footnotes? Q2 How can I get rid of shading in PROC TABULATE output? Q3 How can I get rid of shading in PROC REPORT output? Q4 How can I change column width in PROC TABULATE output? Q5 How can I change column width in PROC REPORT output? Q6 How can I align text or numbers in columns? Q7 How can I change page numbers to start with a number greater than 1? Q8 In RTF output, how can I format characters as subscripts or superscripts? Q9 In RTF output, how can I add spaces in formats for indentation or other purposes? Q10 How can I create a blank line between two footnotes? SOME CAUTIONS Some of the solutions need further explanation. Here they are addressed by question number. Q10: If a blank line has to be left between two footnotes, a blank footnote should be created as illustrated in the example for the superscript/subscript(q8) and indentation(q9). Q4 & Q5: Whenever a CELLWIDTH value is specified, it should be followed by a measurement unit such as cm or in. files. ODS by default assigns page number 1 at the beginning of a file, whereas you do not want the page number to be reset to 1 for the entirety of the collection. The way to get around this depends on the type of file being created. For an RTF file you need a macro that can be obtained from the SAS Institute website. For a PDF file the desired page number should be included in an OPTIONS statement preceding the procedure call. The illustration shows a PDF file starting with page number 5. Q9: In traditional SAS output, it is possible to specify leading blanks in formats and have them respected. However, ODS will ignore multiple leading blanks in applying formats, thus making it impossible to have indentation by normal means. It also collapses multiple consecutive intermediate spaces into one. However, spaces can be maintained in RTF output, with some caveats. The irregular spacing in the final illustration is intentional for displaying relevant concepts. In the format for region, some RTF language coding is used to achieve desired spacing. By placing the text within curly braces {}, one leading blank can be achieved by simply using one leading space. The symbol {\line} results in going to the next line, and use of multiple \~ within curly braces can be used to produce multiple blank spaces. Here, the leading blank between the curly braces for value 01 has produced one space before North Carolina in the first data row of the output. For value 02, the leading blank before Piedmont and the \~ preceding North Carolina have accomplished the same result of skipping one space. The format for value 03 yields interesting results. The nine blank symbols (\~) preceding Mountain do indent the word in the next line. But the way it aligns under the word Tennessee, it seems to have skipped only four spaces rather than nine. This illusion is related to use of proportional fonts. Basically, one needs to experiment until satisfactory results are achieved. CONCLUSION ODS is a powerful tool, but there are many hidden assumptions in creating the destination files. It is possible to modify the default appearance of the output by employing overriding statements and options. Once one has become comfortable with some basic ODS possibilities, one can produce very pleasant output. REFERENCES Haworth, Lauren E., Output Delivery System: The Basics, Cary, NC: SAS Institute Inc., 2001. SAS Institute Inc., The Complete Guide to the SAS Output Delivery System, Version 8, Cary, NC: SAS Institute Inc., 1999. ACKNOWLEDGEMENTS The author wishes to thank the Collaborative Studies Coordinating Center statisticians and programmers for their queries that led to the compilation of the basic questions. The author would like to thank Guochen Song for his help in resolving some of the questions and finding the answers. The work would not have been possible without the support and encouragement of my supervisor Kathy Roggenkamp.. Q7: There may be times when you want to compile a collection of reports from several tables written to different RTF or PDF

CONTACT INFORMATION Varsha C. Shah CSCC, Department of Biostatistics, CB #8030 University of North Carolina Chapel Hill, NC 27514 Phone: 919-966-5160 Fax: 919-966-6335 Email: uccvcs@mail.cscc.unc.edu APPENDIX proc format; value $region '01'="North Carolina Coastal" '02'="North Carolina Piedmont" '03'="Tennessee Mountain" ; value $trtfmt 'T1'="Treatment1" 'T2'="Treatment2" 'T3'="Treatment3" ; options nocenter missing=' '; *************************************************************************************************************; ************************************************ proc report************************************************; *************************************************************************************************************; *-x-x-x-x-x-x- generate the output unadjusted report -x-x-x-x-x-x-*; ods rtf file="&odsoutdir\&job._unadj_report.rtf"; title1 "Proc Report results unadjusted"; proc report data=example1 split='~' nowindows; column region trtment,(ntot avg stdev); define trtment /across order=internal " "; define region /group "REGION" order=internal; define ntot /analysis " N " ; define avg /display "Mean" mean; quit; define stdev /display "STD" mean; Proc Report results unadjusted T1 T2 T3 REGION N Mean STD N Mean STD N Mean STD 01 4 11.25 7.5443135 3 8 3.6055513 3 10.333333 4.163332 02 4 10.75 4.0311289 4 12.75 7.6321688 4 7.5 5.0662281 03 5 10.4 5.2249402 5 9.8 3.8987177 5 11.4 2.4083189 *-x-x-x-x-x-x- generate the output adjusted for shading, column width,alignment -x-x-x-x-x-x-*; ods rtf file="&odsoutdir\&job._adj_report.rtf"; options pageno=5; *Illustrates does not work with RTF file;

Title1 "Proc Report results adjusted for shading, column width, alignment"; proc report data=example1 split='~' nowindows; column region trtment,(ntot avg stdev); define trtment /across format=$trtfmt. style=[background=white ] order=internal " "; *Q3; define region /group format=$region style=[background=white cellwidth=3.7 cm] "REGION" order=internal; *Q3,Q5; define ntot /analysis format=f2.0 center style=[background=white cellwidth=1 cm] quit; define avg " n " ; *Q3,Q5,Q6; /display format=f6.3 style=[background=white cellwidth=1.2 cm] "mean" mean; *Q3,Q5,Q6; define stdev /display format=f6.4 style=[background=white cellwidth=1.2 cm] "STD" mean; *Q3,Q5,Q6; Proc Report results adjusted for shading, column width, alignment Treatment1 Treatment2 Treatment3 REGION N Mean STD N Mean STD N Mean STD North Carolina Coastal 4 11.250 7.5443 3 8.000 3.6056 3 10.333 4.1633 North Carolina Piedmont 4 10.750 4.0311 4 12.750 7.6322 4 7.500 5.0662 Tennessee Mountain 5 10.400 5.2249 5 9.800 3.8987 5 11.400 2.4083 x-x-x-x-x-x- generate the output adjusted for page numbers. -x-x-x-x-x-x-; ods pdf file="&odsoutdir\&job..pdf"; *Q7; options pageno=5; *Q7; Title1 "Proc Report results adjusted for page numbers- pdf file"; proc report data=example1 split='~' nowindows; column region trtment,(ntot avg stdev); define trtment /across format=$trtfmt. style=[background=white ] order=internal " "; define region /group format=$region. style=[background=white cellwidth=3.7 cm] "REGION" order=internal; define ntot /analysis format=f2.0 center style=[background=white cellwidth=1 cm] define avg quit; ods pdf close; *Q7; " n " ; /display format=f6.3 style=[background=white cellwidth=1.3 cm] "mean" mean; define stdev /display format=f6.4 style=[background=white cellwidth=1.3 cm] "STD" mean;

*************************************************************************************************************; ***********************************************proc tabulate***********************************************; *************************************************************************************************************; proc format; value $region '01'="North Carolina Coastal" '02'="North Carolina Piedmont" '03'="Tennessee Mountain(1)" ; **** Fotnotes created for the illustration ***; data _null_; length text1 text2 $65 text3 $180 add_txt1 add_txt2 $210; text1="this footnote is purposely made long for the illustration purposes."; text2="so the two sentences are concatenated. "; text3=left(trim(text1)) ' ' left(trim(text2)); text4="the illustration created by VCS"; text5="illustrate partial font modification"; call symput ("text3",text3); call symput ("text4",text4); call symput ("text5",text5); footnote1 "(1)Includes some bordering counties of North Carolina"; footnote2 "&text3"; footnote3 "&text4"; footnote4 "&text5"; *-x-x-x-x-x-x- generate the output unadjusted - tabulate-x-x-x-x-x-x-*; options nocenter missing=' ' ps=30; ods rtf file="&odsoutdir\&job._unadj_tabulate.rtf"; Title1 "Proc Tabulate results unadjusted"; proc tabulate data=example2 format=20.; CLASS region trtment ; CLASSLEV region trtment ; FORMAT region $region.; VAR n avg std ; TABLE region=' ', trtment=' ' * (n='n' *sum=' ' avg='%' *sum=' '

std ='std' *sum=' ' ) /PRINTMISS MISSTEXT = ' N/A ' RTS=27 BOX =[label="{region}"] ; Proc Tabulate results unadjusted REGION T1 T2 T3 N % STD N % STD N % STD North Carolina Coastal 4 11 8 3 8 4 3 10 4 North Carolina Piedmont 4 11 4 4 13 8 4 8 5 Tennessee Mountain(1) 5 10 5 5 10 4 5 11 2 (1)Includes some bordering counties of North Carolina This footnote is purposely made long for the illustration purpose So the two sentences are concatenated a as text is added. The illustration created by VCS Illustrate partial font modification -x-x-x-x-x-x- generate the output modified for fontsizes, shade, -x-x-x-x-x-x-*; *-x-x-x-x-x-x-cellwidth, and superscripts/subscripts. -x-x-x-x-x-x-*; proc format; value $region '01'="{North Carolina Coastal}" '02'="{North Carolina Piedmont}" '03'="{Tennessee Mountain}{\super(1)\nosupersub}"; *Q8; footnote1 "{\super(1)\nosupersub}{includes some bording counties of North Carolina}"; *Q8; footnote2 height=10pt italic "&text3"; *Q1; footnote3 height=10pt italic "&text4"; *Q1; footnote4 " "; *Creating a blank line between the footnotes; footnote6 height=12pt font='arial' "want only " bold "partial " font='arial' height=12pt "modification"; *Q1; ods rtf file="&odsoutdir\&job._adj_tabulate.rtf"; Title1 "Proc Tabulate results adjusted for shading, fontsize, cellwidth, super/subscripts"; proc tabulate data=example2 missing style=[background=white] format=20.; CLASS region trtment ; CLASSLEV trtment/style=[background=white] ; *Q2; CLASSLEV region /style=[cellwidth=3 cm background=white] ; *Q4,Q2; VAR n avg std /style=[cellwidth=1.0 cm background=white];*q4,q2; FORMAT region $region.;

TABLE region=' ', trtment=' ' * (n='n' *sum=' '*f=2.0 avg='%' *sum=' '*f=4.1 std ='std' *sum=' ' * f=4.2 ) /PRINTMISS MISSTEXT = ' N/A ' RTS=27 BOX =[label="{region}" style=[background=white]] ; *Q2; Proc Tabulate results adjusted for shading, fontsize, cellwidth, super/subscripts REGION T1 T2 T3 N % STD N % STD N % STD North Carolina Coastal 4 11.3 7.54 3 8.0 3.61 3 10.3 4.16 North Carolina Piedmont 4 10.8 4.03 4 12.8 7.63 4 7.5 5.07 Tennessee Mountain (1) 5 10.4 5.22 5 9.8 3.90 5 11.4 2.41 (1) Includes some bordering counties of North Carolina This footnote is purposely made long for the illustration purpose So the two sentences are concatenated as well as text is added. The illustration created by VCS *Q10;; Blank line created by footnote4 Want only partial font modification *-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-*; * generate the output modified for indentation,leading spaces *; *-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-*; ods rtf file="&odsoutdir\&job._adjindent_tabulate.rtf"; proc format; value $region '01'="{ North Carolina}{\line}{Coastal}" '02'="{\~North Carolina}{\line}{ Piedmont}" '03'="{Tennessee}{\line}{\~\~\~\~\~\~\~\~\~Mountain}{\super(1)\nosupersub}"; *Q9,Q8,; Title1 "Proc Tabulate results adjusted for indentation"; proc tabulate data=example2 missing style=[background=white] format=20.; CLASS region trtment ; CLASSLEV trtment/style=[background=white] ; CLASSLEV region /style=[cellwidth=3 cm background=white] ; VAR n avg std /style=[cellwidth=1.0 cm background=white] ; FORMAT region $region.; TABLE region=' ',

trtment=' ' * (n='n' *sum=' '*f=2.0 avg='%' *sum=' '*f=4.1 std ='std' *sum=' ' * f=4.2 ) /PRINTMISS MISSTEXT = ' N/A ' RTS=27 BOX =[label="{region}" style=[background=white]] ; Proc Tabulate results adjusted for indentation REGION T1 T2 T3 N % STD N % STD N % STD North Carolina Coastal 4 11.3 7.54 3 8.0 3.61 3 10.3 4.16 North Carolina Piedmont 4 10.8 4.03 4 12.8 7.63 4 7.5 5.07 Tennessee Mountain (1) 5 10.4 5.22 5 9.8 3.90 5 11.4 2.41 (1) Includes some bordering counties of North Carolina This footnote is purposely made long for the illustration purpose So the two sentences are concatenated as well as text is added. The illustration created by VCS *Q10;; Blank line created by footnote4 Want only partial font modification