Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

The SAS Programmer's PROC REPORT Handbook: ODS Companion
The SAS Programmer's PROC REPORT Handbook: ODS Companion
The SAS Programmer's PROC REPORT Handbook: ODS Companion
Ebook396 pages2 hours

The SAS Programmer's PROC REPORT Handbook: ODS Companion

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Generate reports with style! The SAS Programmer's PROC REPORT Handbook: ODS Companion explains how to use style elements within a style template to customize reports generated by PROC REPORT, leading to more appealing and effective business reports.

Many programmers are faced with generating reports that are easy to read and comprehend for a wide variety of audiences, which is where the ODS destinations and style changes come into play. This book teaches you how to use style elements in PROC REPORT, a versatile reporting procedure, to customize your output. Mastering style elements allows you to change visual aspects of reports, such as borders, column widths, fonts, backgrounds, and more. This companion to The SAS Programmer’s PROC REPORT Handbook: Basic to Advanced Reporting Techniques explores how the style elements within a style template affect the output generated by PROC REPORT. It provides examples of altering the style elements and the effect on the main ODS destinations, while also discussing common pitfalls that programmers can avoid while working with tables, Microsoft Excel, Microsoft Power Point, and PDF output.

LanguageEnglish
PublisherSAS Institute
Release dateMar 16, 2018
ISBN9781635263534
The SAS Programmer's PROC REPORT Handbook: ODS Companion
Author

Jane Eslinger

Jane Eslinger is a Senior Technical Support Analyst at SAS world headquarters in Cary, North Carolina. Jane is a SAS Certified Advanced Programmer for SAS(R)9 and a SAS Certified Advanced Visual Business Analyst. She frequently presents PROC REPORT and ODS topics at conferences and SAS users groups. She is the author of numerous papers and The SAS Programmer's PROC REPORT Handbook: Basic to Advanced Reporting Techniques. In her day-to-day work, Jane enjoys supporting SAS customers using ODS and Base SAS procedures, with an emphasis on PROC REPORT. Prior to joining SAS, Jane served as a statistician and statistical programmer in the social science and clinical research fields. She has a B.S. in Statistics from North Carolina State University.

Related to The SAS Programmer's PROC REPORT Handbook

Related ebooks

Applications & Software For You

View More

Related articles

Reviews for The SAS Programmer's PROC REPORT Handbook

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    The SAS Programmer's PROC REPORT Handbook - Jane Eslinger

    Preface

    There is a reason that the same names appear in so many papers and books on Base SAS and ODS. It is because they are the best of the best. I am immensely grateful to have learned from the following people. My books and papers would not have been possible without them.

    Art Carpenter

    Bari Lawhorn

    Chevell Parker

    Cynthia Zender

    David Kelley

    Kathryn McLawhorn

    Tim Hunter

    Throughout my career at SAS Marcia Surratt has listened to me, encouraged me, and answered all of my questions. She has been a tremendous sounding board and voice of reason. I appreciate her support and am grateful for all of her help.

    I’d like to thank Robert Harris, who provided the wonderful color combinations used throughout this book.

    Brenna Leath and Julie Palmieri from SAS Press encouraged me to write a book every time I spoke to them. I doubt I would have written a book, much less two books, without their persistent encouragement. Thank you ladies.

    Brenna, Stacey Hamilton, and Lauree Shepard all assisted in getting this book completed. Lauree weathered the storm of all of the last minute changes without throwing anything at me, which I greatly appreciate.

    Brenna edited my first book but through my negligence I did not give her proper due last time around. Without her help and guidance neither one of these books would have seen the light of day. Thank you, Brenna.

    Brenna and Vivian McGee have also spent a great deal of time trying to teach me how important commas are in the written word. I have told them that semicolons are a SAS programmer’s best friend! Through their efforts, hopefully both my words and my programs will be helpful to those who read my books and papers.

    Chapter 1

    Introduction: Overview of Chapters

    My previous book, The SAS Programmer's PROC REPORT Handbook: Basic to Advanced Reporting Techniques, (hereafter referred to as Reporting Techniques), provides details about the syntax of PROC REPORT, discusses the options, and shows how to use the statements within the procedure. It includes numerous examples for obtaining the desired report structure and the correct numbers. Chapter 6 of that book provides details and examples for changing the visual aspects of the report, such as coloring cells and adding images. However, because the book is focused on learning PROC REPORT, it does not provide a deep dive into all the ways that PROC REPORT interacts with the Output Delivery System (ODS).

    This book builds on Chapter 6 of my previous book. It explores how the style elements within a style template affect the output generated by PROC REPORT. Each ODS destination has its own unique purpose and underlying architecture, which means that each ODS destination renders PROC REPORT and its accompanying style attributes differently. The purpose of this book is to explore and understand those differences and to use PROC TEMPLATE and PROC REPORT code to get the best output possible.

    Chapter 2 in this book describes style templates. It explains where they are stored, how to determine the names of styles shipped with SAS, and how to use the general syntax of PROC TEMPLATE. PROC TEMPLATE is the mechanism for making changes to existing style templates or creating new style templates. The chapter addresses only PROC TEMPLATE with style templates. PROC TEMPLATE can be used with table template definitions. However, they are beyond the scope of this book.

    Chapter 3 provides an in-depth look at the style elements that are documented to affect PROC REPORT tables. Examples show how setting specific style attributes can change the appearance of the output in various destinations. ODS has many destinations to which PROC REPORT output can be saved. This chapter explores a handful of destinations, which include the following:

    ●   RTF

    ●   PDF

    ●   HTML

    ●   ODS Destination for Excel

    ●   ODS Destination for PowerPoint

    ●   Tagsets.ExcelXP

    ●   SASReport

    I do not discuss the Listing destination in this book. The Listing destination creates monospace text output. It does not have the capabilities to add the formatting and style changes that are desired in most of today’s reports.

    Chapter 4 discusses style overrides that are specified within the PROC REPORT code. The STYLE= option is available in most statements within the procedure. This chapter discusses effective ways of using the option.

    All the common style changes needed for PROC REPORT tables were covered in my previous book. However, each ODS destination has unique capabilities and quirks. The remaining chapters in this book focus on the individual destinations and how to take advantage of their strengths or program around their weaknesses.

    InChapter 5, I concentrate on the PDF destination. I discuss the style templates that provide the best results. The chapter explains border manipulation at length because PDF handles borders differently than any other destination. The chapter also covers the SPANROWS option and the new accessibility feature available with SAS 9.4 TS1M5.

    Chapter 6 concentrates on the RTF and Tagsets.RTF destinations. It compares and contrasts the two destinations and shows how those differences affect PROC REPORT tables. I provide an in-depth discussion of the behavior of the SPANROWS option.

    Chapter 7 concentrates on the destinations that create output rendered by Microsoft Excel. The ODS destination for Excel, Tagsets.ExcelXP, HTML, MSOffice2K, and MSOffice2K_X all create output that can be viewed in Excel. This chapter looks at the suboptions available in those destinations that can be used to alter PROC REPORT tables. It demonstrates how each destination can pass instructions that are specific to Excel to Microsoft.

    Chapter 8 concentrates on the HTML and HTML5 destinations. The HTML5 destination is slowly becoming the default HTML destination because it uses the latest HTML standard. In this chapter, I compare and contrast the HTML destination with the HTML5 destination.

    Chapter 9 concentrates on the ODS destination for PowerPoint. The destination for PowerPoint is unique among all of the destinations discussed in this book. The destination uses a style template that does not inherit from a parent. The font and overall table size are much larger than in other destinations. This chapter discusses strategies for modifying PROC REPORT code to fit the output onto a slide and to ensure its readability. .

    Although Chapter 3 shows what the PROC REPORT output looks like in the SASReport destination, I do not devote an entire chapter to it. I have found that most final production reports are created in one of the other destinations. Also, the SASReport destination will remain available, but it will soon be replaced by HTML5 as the default destination in SAS Enterprise Guide. Like the other destinations, if SASReport is the desired destination for output, the style template and style overrides should be written with SASReport in mind.

    My goal with this book is to teach you how to use style changes to produce your desired report to whichever destination the PROC REPORT table is sent. This book does not explain PROC REPORT syntax except in the context of style changes. Refer to The SAS Programmer's PROC REPORT Handbook: Basic to Advanced Reporting Techniques for details about PROC REPORT syntax.

    Also, this book cannot cover everything there is to know about ODS, style templates, or PROC TEMPLATE. The book covers only those areas as they relate to PROC REPORT. Although it covers a large amount of information, the topics and examples focus on the reports and questions that I have received from programmers in my day job as a Technical Support Analyst at SAS.

    The book uses the data set ORDERS. As mentioned in the preface, the data set can be downloaded from the authors page at http://support.sas.com/publishing/authors/eslinger.html. Also, a program called createfmts.sas, is also available for download from the authors page. It creates a temporary format catalog that contains the formats that are needed in the examples throughout the book.

    Chapter 2

    PROC TEMPLATE Overview

    2.1 Introduction

    2.2 Default Style Templates

    2.3 Location of Style Templates

    2.4 Viewing Style Templates

    2.5 General Syntax of PROC TEMPLATE

    2.6 STYLE versus CLASS Statements

    2.7 Inheritance

    2.8 Style Attributes

    2.9 Key Takeaways

    2.1 Introduction

    Every piece of output that SAS generates is controlled by a template. The tables generated by the REPORT, MEANS, GLM, and other procedures are controlled by table templates. The visual aspects of the files generated by the Output Delivery System (ODS) are controlled by style templates. The TEMPLATE procedure can be used to modify some of the table templates and to modify all of the style templates.

    Style templates are powerful tools for generating attractive output. They help make the tables generated by PROC REPORT informative and easy to read. However, before learning how style templates affect PROC REPORT, you need to understand what is already provided by SAS.

    This chapter discusses the style templates that are shipped by SAS, including where they are stored and how to see what each style looks like. The chapter also explains the syntax of PROC TEMPLATE. The end of the chapter discusses inheritance concepts and how to find information about specific attributes.

    Please note that this chapter focuses solely on style templates that are generated by PROC TEMPLATE. Most of the formatted ODS destinations allow the use of a Cascading Style Sheet (CSS) to affect the style of the output. The use of CSS is beyond the scope of this book. CSS is a great tool, but many SAS programmers do not have experience using it and therefore rely on PROC TEMPLATE to make style changes.

    2.2 Default Style Templates

    Several style templates are automatically shipped with Base SAS. Each is designed to be used with a specific ODS destination, although many are often used with multiple destinations. A list of styles and a table of the suggested destinations are in the ODS Styles Reference section of the SAS 9.4 Output Delivery System: User’s Guide. Each ODS destination defaults to using a specific style template, as shown in Table 2.1.

    Table 2.1 ODS Destinations and Their Default Style Templates

    Each SAS interface generates output to a default destination. For example, by default, the SAS windowing environment (Display Manager SAS) creates HTML, SAS Enterprise Guide generates SASReport, and SAS Studio generates HTML5 output. Each interface has the capability to change the style template used by the destination. In the SAS windowing environment, the style template is listed under Tools ▶ Options ▶ Preferences ▶ Results ▶ Style. In SAS Enterprise Guide, the style template is specified under Tools ▶ Options ▶ Results ▶ ▶ Style. In SAS Studio, the style template is specified in Options ▶ Preferences ▶ Results.

    Programmers can also choose to close the default destination and use ODS statements to direct the output to any destination. ODS statements can be used in any type of SAS interface. If a style template other than the default is preferred, it can be specified with the STYLE= option in the ODS statement. The style templates provided by SAS can be used without any modifications or special code. For example, to use the SASWEB style for HTML output instead of the default HTMLBlue, the syntax is:

    ods html path=mypath file=myfile.html style=styles.sasweb;

    The prefix styles. is not strictly necessary because styles stored in the styles folder, which contain templates that are supplied by SAS, are automatically searched. Therefore, programs might also use this syntax:

    ods html path=mypath file=myfile.html style=sasweb;

    2.3 Location of Style Templates

    The style template definitions shipped with SAS are stored in the SASHELP.TMPLMST template store. A template store is a SAS item store that holds templates. Here is the definition of item store from SAS 9.4 Output Delivery System: User’s Guide:

    a SAS library member that consists of pieces of information that can be accessed independently. The contents of an item store are organized in a directory tree structure, which is similar to the directory structures that are used by UNIX System Services or by Windows. For example, a particular value might be stored and located using a directory path (root_dir/sub_dir/value). The SAS Registry is an example of an item store.

    The physical location of the item or template store file can be identified by knowing the location of the SASHELP directory. The PROC OPTIONS step in Example 2.1 will provide the location of the SASHELP directory.

    Example 2.1 Determine the Location of the SASHELP Directory

    proc options option=sashelp;

    run;

    The result of this code is written to the log. The contents of the log will look similar to Output 2.1, depending on your license and how SAS is installed on your system.

    Output 2.1 SASHELP Location

    The TMPLMST file is most likely in !SASROOT\core\sashelp. Figure 2.1 shows a screen capture from a typical Windows installation.

    Figure 2.1 SASHELP Location on a Windows System

    Another template store that is automatically created during installation is SASUSER.TEMPLAT. In most installations, the SASHELP directory is read-only. Therefore, new or modified templates are most likely saved in SASUSER.TEMPLAT.

    When a template style is needed, SAS looks for the name of that style in the available template stores. To determine which template store is searched first and the type of access assigned to each store, use an ODS PATH statement, as shown in Example 2.2.

    Example 2.2 ODS PATH Statement

    ods path show;

    The result of this code, which is written to the log, will look similar to Output 2.2, depending your setup.

    Output 2.2 Default ODS PATH

    In some configurations, both the SASHELP and SASUSER directories are set for Read-Only access. In those configurations, a new template must be stored in a template store in the WORK location or another location that allows Write or Update access. To write to a location other than SASUSER, or SASHELP, use the code in Example 2.3. The example submits an ODS PATH statement that specifies the desired location, which is

    Enjoying the preview?
    Page 1 of 1