Creating a Publish to Archive Report from Table Data

Overview

Use a Publish to Archive transformation to create an HTML report and an archive file so that the report can be re-created using SAS Package Retriever. You can control many aspects of how the report is created, including the following:
  • the title of the report
  • the location of the report and the archive
  • which columns are analyzed
The Publish to Archive transformation uses the Publishing Framework feature of SAS Integration Technologies. This framework provides a complete and robust publishing environment for enterprise-wide information delivery. It consists of SAS CALL routines, application programming interfaces (APIs), and graphical user interfaces that enable both users and applications to publish SAS files (including data sets, catalogs, and database views), other digital content, and system-generated events to a variety of destinations such as email addresses, message queues, publication channels and subscribers, WebDAV-compliant servers, and archive locations.
The Publishing Framework also provides tools that enable both users and applications to receive and process published information. For example, users can receive packages with content, such as charts and graphs, that is ready for viewing. SAS programs can receive packages with SAS data sets that might in turn trigger additional analyses on that data.

Problem

You want to create and print an HTML report. Then, you want to save an archived version of the data.

Solution

You can use a Publish to Archive transformation in a job that creates and archives an HTML report. For example, you can create a job similar to the sample job featured in this topic. This sample job generates a report that is based on a table that contains information about business invoices. 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.
  2. Select and drag a Publish to Archive transformation from the Publish folder in the Transformations tree. Then, drop it in the empty job on the Diagram tab in the Job Editor window.
  3. Right-click the Publish to Archive transformation and select Portsthen selectAdd Input Port.
  4. Select and drag the source table from the Inventory tree. Then, drop it before the Publish to Archive transformation on the Diagram tab.
  5. Drag the cursor from the source table to the input port of the Publish to Archive transformation. This action connects the source to the transformation.
  6. 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 displayed, enable it with the Show Output tab check box on the General tab of the Options item in the Tools menu.) The following display shows a sample process flow diagram for a job that contains the Publish to Archive transformation.
    Sample Process Flow
    Sample Process Flow
    Note that the source table for the sample job is named INVOICE_SORTED.

Configure SAS Table and Reporting Options

Use the Options tab in the properties window for the Publish to Archive transformation to configure the SAS tables that are generated in the job and shape the output of your analysis. Note that the Options tab is divided into two parts, with a list of categories on the left-hand side and the options for the selected category on the right-hand side. Perform the following steps to set the options that you need for your job:
  1. Open the properties window for the Publish to Archive transformation on the Diagram tab in the Job Editor window. Then, click the Options tab.
  2. Click Columns to report on to access the Columns to report on columns page. Use the column selection prompts to access the columns that you need in the SAS tables included in your job. For example, you can click Column Selection for the Select other columns to print (VAR statement) to access the Select Data Source Items window, as shown in the following display.
    Sample Select Data Source Items Window
    Sample Select Data Source Items Window
    In the sample job, the VAR statement columns are prodname, invqty, and invprice. The column assignment options for the sample job are shown in the following display.
    Sample Options Properties
    Sample Options Properties
  3. Set the publication options for the report on the Publishing options page. The options for the sample job are shown in the following display.
    Sample Publication Options
    Sample Publication Options
    Note that the options to set a path for the archive file and specify the archive filename are required.
  4. Set the remaining options for your report in the appropriate fields. For example, the path and filename for the report generated by the sample job are specified in the Specify path and filename for generated report field on the Report specifications page. (Make sure that you click Generate PROC PRINT from input table in the Generate PROC PRINT or send existing report field). A title for the sample job report is set on the Titles and Footnotes page.

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.
    Successfully Completed Sample Job
    Successfully Completed Sample Job
  2. If error messages are displayed on the Status tab, read and respond to the messages as needed.
  3. To view the generated reports, click the Output tab in the Job Editor window. The following display shows the report for the sample job.
    Sample Output in the Output Tab
    Sample Output in the Output Tab
    You can find the archive file (invarchive.spk) in the directory that you specified. You can access the archive file with the SAS Package Retriever. The archive file is a compressed file that has to be unzipped for the report to be viewed.
  4. Navigate to the HTML file using the path that you configured on the Report specifications page on the Options tab. Sample HTML output is shown in the following display.
    Sample PDF Output
    Sample PDF Output