PROC REPORT by Example

Book description

PROC REPORT by Example: Techniques for Building Professional Reports Using SAS provides real-world examples using PROC REPORT to create a wide variety of professional reports. Written from the point of view of the programmer who produces the reports, this book explains and illustrates creative techniques used to achieve the desired results.

Each chapter focuses on a different concrete example, shows an image of the final report, and then takes you through the process of creating that report. You will be able to break each report down to find out how it was produced, including any data manipulation you have to do.

The book clarifies solutions to common, everyday programming challenges and typical daily tasks that programmers encounter. For example:
obtaining desired report formats using style templates supplied by SAS and PROC TEMPLATE, PROC REPORT STYLE options, and COMPUTE block features
employing different usage options (DISPLAY, ORDER, GROUP, ANALYSIS, COMPUTED) to create a variety of detail and summary reports
using BREAK statements and COMPUTE blocks to summarize and report key findings
producing reports in various Output Delivery System (ODS) destinations including RTF, PDF, XML, TAGSETS.RTF
embedding images in a report and combining graphical and tabular data with SAS 9.2 and beyond

Applicable to SAS users from all disciplines, the real-life scenarios will help elevate your reporting skills learned from other books to the next level.

With PROC REPORT by Example: Techniques for Building Professional Reports Using SAS, what seemed complex will become a matter of practice.

This book is part of the SAS Press program.

Table of contents

  1. About This Book
  2. Acknowledgements
  3. Chapter 1: Creating Complementary Reports
    1. Introduction
    2. Example: Department Store Summary and Detail Reports
    3. Goals for Creating Complementary Reports
      1. Key Steps
    4. Source Data
    5. ODS Style Template Used
    6. Programs Used
    7. Implementation
      1. Create a Setup Program that Contains Common SAS Code
      2. Ch1Setup.SAS
    8. Writing the Detail Report Program
      1. Detail Report Pre-Processing Code
    9. Detail Report: Titles, Footnotes, and ODS RTF Preparation
      1. Code for Titles, Footnotes, and ODS RTF Preparation
    10. Producing the Report with PROC REPORT
      1. Detail Report - PROC REPORT Code
    11. Writing the Summary Report Program
      1. Map Separate Variables/Values to One Column for PROC REPORT
      2. Summary Report - Pre-Processing Code
      3. Assign Report Order to Variables
      4. Code for Creating Ordered Variables
      5. Summary Report: Titles, Footnotes, and ODS RTF Preparation
      6. Code for Titles, Footnotes, and ODS RTF Preparation
    12. Producing the Report with PROC REPORT
      1. Summary Report - PROC REPORT Code
    13. Chapter 1 Summary
  4. Chapter 2: Formatting Highly Detailed Reports
    1. Introduction
    2. Example: Format National Sales Report
    3. Goals for Formatting the National Sales Report
      1. Key Steps
    4. Source Data
    5. ODS Style Template Used
    6. Programs Used
    7. PROC TEMPLATE Program to Create New Style Template
    8. The “Before Formatting” Program (Program 2.1)
    9. Implementation
    10. Transforming Figure 2.1 Into Figure 2.2
    11. Displaying Region as a Line Above Each Report Page
      1. Overview of Region Display
      2. Code to Make the Region Display in Figure 2.3
    12. Displaying Store and Branch Column Data in Bold Blue Font
      1. Code for Store and Branch Display
    13. How to Insert Arrows for Quick Reference to Sales Increases/Decreases
      1. Overview on Arrow Insertion
      2. Code for Arrow Insertion
    14. How to Add Spanning Headers, Bottom Cell Borders, and Underlines
      1. Highlights on Adding Spanning Headers, Borders, and Underlines
      2. Code for Adding Spanning Headers, Borders, and Underlines
    15. Adding Blank Columns to Make the Report More Legible
      1. Overview of Adding Blank Columns
      2. Code for Adding Blank Columns
    16. Style: Add a Blank Line After Each Summary Line
      1. Highlights on Styling Summary Line and Adding a Blank Line
      2. Code for Styling Summary Line and Adding a Blank Line
    17. Chapter 2 Summary
  5. Chapter 3: Reporting Different Metrics Within a Column
    1. Introduction
    2. Example: Demographic and Baseline Characteristics Report
    3. Goals for the Demographics and Baseline Characteristics Report
      1. Key Steps
    4. Source Data
    5. ODS Style Template Used
    6. Programs Used
    7. Implementation
    8. Obtain Population Counts for Column Headers and Denominators
      1. Code for Obtaining Population Counts
    9. Categorical Variables: Obtain Counts and Percentages
      1. Code for Obtaining Categorical Counts and Percentages
    10. Continuous Variables: Descriptive Data
      1. Macro Code for Obtaining Descriptive Statistics
    11. Create Final Table: Combine TABULATE and MEANS Results
      1. Code for Combing the Results
    12. Produce the Report via PROC REPORT
      1. PROC REPORT Code
    13. Chapter 3 Summary
  6. Chapter 4: Lesion Data Quality Report—COMPUTE Blocks
    1. Introduction
    2. Example: Lesion Data Quality Report
    3. Goals for Creating the Lesion Data Quality Report
      1. Key Steps
    4. Source Data
    5. ODS Style Template Used
    6. Programs Used
    7. Implementation
      1. COMPUTE Block Variables: DATA Step (Temporary) Versus REPORT (COLUMN Statement) Variables
    8. ORDER by and Print Subject ID on Every Row with Greying Font
      1. Program for Subject ID Display
    9. Identify Potential Data Issues
      1. Code for Displaying Potential Data Issues
    10. Final Formatting: Create Spanning Headers
    11. Chapter 4 Summary
  7. Chapter 5: Multi-Sheet Workbook With Histograms—ExcelXP Tagsets Report
    1. Introduction
    2. Example: Multi-Sheet Workbook Containing Heart Study Results
    3. Goals for Creating the Multi-Sheet Workbook
      1. Key Steps
    4. Source Data
    5. ODS Style Template Used
    6. Programs Used
    7. Implementation
    8. Create Formats and Informats
      1. Code for Creating Formats and Informats
    9. Obtain Counts and Percentages
      1. Code for Obtaining Counts and Percentages
    10. Producing the Workbook With PROC REPORT and ODS Tagset
      1. Code for Opening, Closing, and Setting Initial Options for the ExcelXP Workbook
    11. Producing the Specific Worksheets
      1. Code for Producing ByStatusCOL and ByStatusROW Worksheets
      2. Code for Producing ByStatusALL Worksheet
    12. Chapter 5 Summary
  8. Chapter 6: Using the ACROSS Option to Create a Weekly Sales Report
    1. Introduction
    2. Example: Weekly Sales Report
    3. Goals for Creating a Weekly Sales Report
      1. Key Steps
    4. Source Data
    5. ODS Style Template Used
    6. Programs Used
    7. Implementation: Creating the ODS Style Template
      1. Proc Template Code
    8. Obtain Calendar Grid and Merge With Sales
    9. Produce the Report
      1. Code for Producing the Report
    10. Place Holders for Data Not Yet Available
    11. Chapter 6 Summary
  9. Chapter 7: Embedding Images in a Report
    1. Introduction
    2. Example: Tables Displaying Iris Flower Measurements
    3. Goals for Embedding Images in Reports
    4. Source Data
    5. ODS Style Templates Used
    6. Programs Used
    7. Implementation
      1. Setup Options, File Paths, and Image File Names
      2. Program Setup Code
    8. Example 1: Obtain Images as Column of Data
      1. Code for Obtaining Images as Column of Data
    9. Example 2: Repeated Images Above and Below Table
      1. Code for Repeating Images Above and Below Table
      2. Produce the Report
    10. Example 3: Display Images as Column Headers
      1. Code for Displaying Images as Column Headers
    11. Example 4: Display Image in Page Title
      1. Code for Displaying Images in Page Titles
    12. Example 5: Display Image Above Body of Table
      1. Code for Displaying Image Above Body of Table
    13. Example 6: Display Watermark on Report
    14. Chapter 7 Summary
  10. Chapter 8: Combining Graphs and Tabular Data
    1. Introduction
    2. Example: Dashboard Report of Shoe Sales
    3. Goals for Creating the Shoe Sales Dashboard
      1. Key Steps
    4. Source Data
    5. ODS Style Template Used
    6. Programs Used
    7. Implementation
    8. Create a Summary Data Set using PROC REPORT
      1. Code for Creating a Summary Data Set
    9. Obtain Regional Ranking Information
      1. Code for Obtaining Regional Ranking Information
    10. Create a New ODS Style Template
    11. Create the ODS LAYOUT for the Report
    12. Create Formats Needed for Outputs
    13. Use PROC SGPLOT to Create Vertical Bar Charts
      1. Code for SGPLOT Vertical Bar Charts
    14. Using PROC SGPLOT to Create a Horizontal Bar Chart
      1. Horizontal Bar Chart Code
    15. Using PROC REPORT to Obtain Tabular Output
    16. Using PROC SGPANEL to Create Bar Charts for the Top 3 Regions
    17. Chapter 8 Summary
  11. Chapter 9: Using PROC REPORT to Obtain Summary Statistics for Comparison
    1. Introduction
    2. Example: Vehicle MSRP Comparison Report
    3. Goals for MSRP Comparison Report
      1. Key Steps
    4. Source Data
    5. ODS Style Template Used
    6. Programs Used
    7. Implementation
    8. Initial PROC REPORT for Obtaining Statistics
      1. Code for Obtaining Statistics
    9. Produce the Report
      1. Code for Print Report
    10. Chapter 9 Summary
  12. References
  13. DATA SETS
  14. Index

Product information

  • Title: PROC REPORT by Example
  • Author(s): Lisa Fine
  • Release date: December 2013
  • Publisher(s): SAS Institute
  • ISBN: 9781612909134