Creating Reports from Table Data

Overview

The List Data transformation provides an interface to the PRINT procedure. The PRINT procedure prints the observations in a SAS data set, using all or some of the variables. You can create a variety of reports ranging from a simple listing to a highly customized report that groups the data and calculates totals and subtotals for numeric variables. You can also use it to write the contents of a table (including a temporary output table) to a report. The PRINT procedure enables you to control many aspects of how the report is created, including the following:
  • the title of the report
  • how the observations in the report are grouped
  • which columns are summed
  • which columns are displayed and in what order
Generally, the List Data generated transformation comes at the end of a process flow diagram and prints data from the last table in the job. However, the transformation produces a temporary output table whose contents are identical to the contents of the input table, so you can use the transformation to create a report that is based on the temporary output table.

Problem

You want to print the data from a table in a report. For example, you can create a sort job and print the results in a PDF report.

Solution

You can use the List Data transformation as an interface to the PRINT procedure in a job that generates a report. For example, you can create a job similar to the sample job featured in this topic. This sample job sorts the data in a table that contains information about employees by sex and name. Note that the output for this job is sent to the Output tab in the Job Editor window and to an ODS document that is configured in the job. The sample job includes the following tasks:

Tasks

Create and Populate the Job

Perform the following steps to create and populate the job:
  1. Create an empty SAS Data Integration Studio job or open an existing job. For example, you can open a sort job.
  2. Select and drag a List Data transformation from the Output folder in the Transformations tree. Then, drop it in the sort job on the Diagram tab in the Job Editor window.
  3. Ensure that the output of the job can be sent to the Output tab of the Job Editor window. If the Output tab is not available, enable it by selecting Tools Optionsthen selectShow Output tab in the menu bar.
  4. Drag the cursor from the target table to the input port of the List Data transformation. This action connects the target to the transformation. The following display shows a sample process flow diagram for a job that contains the List Data transformation.
    Sample Process Flow
    Sample Process Flow
    Note that the source table for the List Data transformation in the sample job is named ALL_FEMALE. This table is the target table for the Sort transformation.

Configure Analytical Options

Use the Options tab in the properties window for the List Data transformation to configure the output for your analysis. Note that the Options tab is divided into two parts, with a list of categories on the left side and the options for the selected category on the right side. Perform the following steps to set the options that you need for your job:
  1. Open the properties window for the List Data transformation in the Diagram tab in the Job Editor window. Then, click the Options tab.
  2. Click Report formatting to access the Report formatting page and select the formatting options for your report. For example, you can select the options shown in the following display:
    Sample Report Formatting Options
    Sample Report Formatting Options
  3. Click Columns to report on to access the Columns to report on page. Use the column selection prompts to access the columns that you need for your job. For example, you can click Column Selection for the Select other columns to print (VAR statement) field to access the Select Data Source Items window, as shown in the following display:
    Select Data Source Items Window
    Select Data Source Items Window
    Once you have selected the columns you need, the Select other columns to print (VAR statement) is populated, as shown in the following display:
    Sample Selected Columns to Print
    Sample Selected Columns to Print
    Note: You can specify additional PROC PRINT options and statements on the Other options page.

Configure Reporting Options

Use the remaining option pages to create and save an HTML, RTF, or PDF version of the output from the List Data transformation. Perform the following steps to set options for the document:
  1. Click ODS options to access the ODS options page. You can choose between HTML, RTF, and PDF output and enter appropriate settings for each. The sample job uses PDF output. Therefore, a location, a set of keywords, and the subject of the report are added to the fields that are displayed when Use PDF is selected in the ODS result field. (The path specified in the Location field is relative to the SAS Application Server that executes the job.) These fields are shown in the following display:
    Sample ODS Options
    Sample ODS Options
  2. Click OK to save the settings for the Options tab.

Run the Job and View the Output

Perform the following steps to run the job and view the output:
  1. Right-click on an empty area of the job, and click Run in the pop-up menu. SAS Data Integration Studio generates code for the job and submits it to the SAS Application Server for execution. The following display shows a successful run of a sample job:
    Sample Completed Job
    Sample Completed Job
  2. If error messages display on the Status tab, read and respond to the messages as needed.
  3. To view the data listing, click the Output tab in the Job Editor window.
    Sample Output in the Output Tab
    Sample Output in the Output Tab
  4. Open the PDF document that you created and saved earlier. The following display illustrates a sample report based on the correlations data.
    Sample PDF Output
    Sample PDF Output
Last updated: January 16, 2018