Ad Hoc Reports

Overview of Ad Hoc Reports

To create an ad hoc report, you must first write a SAS report program. When the report code is ready, you copy your code to the SAS Editor tab in the Create Ad Hoc Report window . You then submit your program. Unlike the user-defined report, the ad hoc report does not require auxiliary files to be uploaded to the SAS Content Server.
To create your report output in either HTML, PDF, RTF, or Excel, or to specify a style other than the default style for your report, you modify your report with code that is provided by SAS and that enables you specify the report output format and style. The code that you need to add to your program is included in the steps to create an ad hoc program.
If you find an error in your report code, you must delete the report in the Project Tree, fix your code in your source file, and submit the code in the Create Ad Hoc Report window again.

Create an Ad Hoc Report

To create an ad hoc report, you must first create a SAS program. Test your program in SAS before you run your program as a SAS Model Manager ad hoc report. After the code runs successfully, you can create the ad hoc report.
To create an ad hoc report, follow these steps:
  1. Expand the version folder Version Icon.
  2. Right-click the Reports node and select Reportsthen selectCreate Ad Hoc Report. The Create Ad Hoc Report window appears.
  3. In the Select Models table, select any number of models.
  4. Either add the following code to your report program or copy the code to the SAS Editor. This code defines the report output format, such as HTML or PDF, and the report style:
    Filename mmreport catalog "sashelp.modelmgr.reportexportmacros.source";
    %include mmreport;
    %MM_ExportReportsBegin(reportFormat=report-format, reportStyle=report-style,
       fileName=report-name);
              …
       add-your-ad-hoc-code-here
              …
    %MM_ExportReportsEnd(reportFormat=report-format);
    
    Replace report-format in the %MM_ExportReportsBegin macro with one of the following values: HTML, PDF, RTF, or Excel.
    Replace report-style with one of the following values: SAS default, Seaside, Meadow, or Harvest.
    Replace report-name with the name of your ad hoc report. The characters @ \ / * % # & $ ( ) ! ? < > ^ + ~ ` = { } [ ] | ; : ‘ " cannot be used in the name.
  5. Copy your SAS program to the SAS Editor. Make sure that your report program is enclosed by the SAS code that defines the report output format. You can click the Macro Variables tab to view a list of the Model Manager macro variables that can be accessed by your program.
  6. Enter the report name and a description for the report in the Report Properties table.
  7. Click OK. SAS Model Manager runs the report and creates a node under the Reports node using the name that you provided in the Report Properties table. The new node contains the output files that were created by running the report.
    A message box confirms that the report either was completed successfully or failed. If the report failed, click Details to review the errors in the SAS log.

Example Ad Hoc Report

The following example code lists the score results in an HTML output format:
Filename mmreport catalog "sashelp.modelmgr.reportexportmacros.source";
%include mmreport;

%MM_ExportReportsBegin(reportFormat=html, reportStyle=Meadow, fileName=PerfDS); 
proc print data=myTable.scoretable;
var loan delinq score;
run;
quit;


%MM_ExportReportsEnd(reportFormat=html);
When you include this program in the Create Ad Hoc Report window, it looks like this:
Create Ad Hoc Report Window
After you click OK, SAS Model Manager creates the report and places the report output under the Reports folder in the Project Tree:
Ad Hoc Report in the Reports Folder
The following HTML output displays selected rows of 5000 possible rows of output:
Ad Hoc Report Output