Creating a Publish to Queue Report from Table Data

Overview

Use the Publish to Queue transformation to create an HTML report that is sent to an MQSeries queue or a Microsoft MQ queue. Here are some of the many aspects that you can control when creating reports:
  • the title of the report
  • the location of the report and the archive
  • the columns that 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 also receive packages with SAS data sets that might in turn trigger additional analyses on that data.
Note: You must have MQSeries or Microsoft MQ installed before you can publish to a queue. In addition, the queue must exist before you publish to it, and you must have appropriate authorization to write to it.

Problem

You want to print an HTML report and send it to a queue using MQSeries or Microsoft MQ.

Solution

You can use the Publish to Queue transformation in a job creates an HTML report and sends it to a message queue. 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 Queue 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 Queue transformation and select Portsthen selectAdd Input Port.
  4. Select and drag the source table out of the Inventory tree. Then, drop it before the Publish to Queue transformation on the Diagram tab.
  5. Drag the cursor from the source table to the input port of the Publish to Queue 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 in 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 Queue transformation.
    Sample Process Flow
    Sample Process Flow
Note that the source table for the sample job is named INVOICE_SORT.

Configure Transformation Options

Use the Options tab in the properties window for the Publish to Queue 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-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 Queue transformation in 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 for 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 Column Options
  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 Publishing Options
    Sample Publishing Options
    Note that the option to specify a queue is required.
  4. Set the remaining options for your report in the appropriate fields. For example, an appropriate path and filename for the report generated by the sample job must be 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 PRINTor 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 Submit in the pop-up menu. SAS Data Integration Studio generates code for the job and submits it to the SAS Application Server for execution. A completed sample job is shown in the following display.
    Sample Completed Job
    Sample Completed Job
  2. If error messages display, read and respond to the messages as needed.
  3. Click the Output tab. Your output should resemble the following display.
    Sample Output in the Output Tab
    Sample Output in the Output Tab
    The packaged file (queue.spk) is also sent to the designated queue using MQSeries.
  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 HTML Output
    Sample HTML Output
Last updated: January 16, 2018