Customized ODS Output

SAS Output

By default, ODS output is formatted according to instructions that a PROC step or DATA step defines. However, ODS provides ways for you to customize the output. You can customize the output for an entire SAS job, or you can customize the output for a single output object.

Selection and Exclusion Lists

For each ODS destination, ODS maintains either a selection list or an exclusion list of output objects. You can use the default output objects selected or excluded for each destination or you can specify which output object you want to produce by selecting or excluding them from a list.
A selection list is a list of output objects that are sent to an ODS destination. An exclusion list is a list of output objects that are excluded from an ODS destination. ODS also maintains an overall selection or exclusion list of output objects. By checking the destination-specific lists and the overall list, ODS determines what output objects to produce. These lists can be modified by using the ODS SELECT statement and the ODS EXCLUDE statement.
You can view the contents of the exclusion and selection lists by using the ODS SHOW statement. The contents information is written to the SAS log.
EXCLUDE ALL is the default setting for the ODS OUTPUT destination. SELECT ALL is the default setting for all other destinations. To change the default selection and exclusion lists, use the ODS SELECT or ODS EXCLUDE statements or use the exclude and select actions that are available for some of the ODS statements. However, to set the exclusion list for the OUTPUT destination to something other than the default, use the ODS OUTPUT Statement . For a list of ODS Output destinations and explanations of each, see Understanding ODS Destinations.
In order to view output objects that are selected or excluded from your program, use the ODS TRACE statement. The ODS TRACE statement prints the output objects that are selected and excluded and puts the information in a trace record that is written to the SAS log. The trace provides the path, the label, and other information about output objects that are selected and excluded. For complete documentation about viewing and selecting output objects, see the ODS SELECT Statement , the ODS EXCLUDE Statement, and the ODS TRACE Statement.

How ODS Determines the Destinations for an Output Object

As each output object is produced, ODS uses the selection and exclusion lists to determine which destination or destinations the output object will be sent to. Figure Directing an Output Object to a Destination illustrates this process.
For each destination, ODS first asks whether the list for that destination includes the object. If it does not, ODS does not send the output object to that destination. If the list for that destination does include the object, ODS reads the overall list. If the overall list includes the object, ODS sends it to the destination. If the overall list does not include the object, ODS does not send it to the destination.
Directing an Output Object to a Destination
Directing an Output Object to a Destination
Note: Although you can maintain a selection list for one destination and an exclusion list for another, it is easier to understand the results if you maintain the same types of lists for all the destinations where you route output.

Customized Output for an Output Object

For a procedure, the name of the table template that is used for an output object comes from the procedure code. The DATA step uses a default table template unless you specify an alternative with the TEMPLATE= suboption in the ODS option in the FILE statement. For more information, see the section on the TEMPLATE= suboption in FILE Statement for ODS.
To find out which table templates a procedure or the DATA step uses for the output objects, you must look at a trace record. To produce a trace record in your SAS log, submit the following SAS statements:
ods trace on;
your-proc-or-DATA-step
ods trace off;
Remember that not all procedures use table templates. If you produce a trace record for one of these procedures, no template appears in the trace record. Conversely, some procedures use multiple table templates to produce their output. More than one template appears in the trace record produced in the log.
For a detailed explanation of the trace record, see the ODS TRACE Statement.
You can use PROC TEMPLATE to modify an entire table template. When a procedure or DATA step uses a table template, it uses the elements that are defined or referenced in its table template. In general, you cannot directly specify a table element for your procedure or DATA step to use without modifying the template itself.
Note: Three Base SAS procedures, PROC PRINT, PROC REPORT, and PROC TABULATE, do provide a way for you to access table elements from the procedure step itself. Accessing the table elements enables you to customize your report. For more information about these procedures, see the Base SAS Procedures Guide.

Customizing Titles and Footnotes

You can use the global TITLE and FOOTNOTE statements to enhance the readability of any report. These statements have associated options that enable you to customize the style of the titles and footnotes when they are used with ODS. Because these options control only the presentation of the titles and footnotes, they have no effect on objects that go to the LISTING or OUTPUT destination. Examples of these style options are BOLD, COLOR=, and FONT=. For a complete list of style options, detailed information about the style options, and example code, see the TITLE statement and the FOOTNOTE statement in the SAS Statements: Reference.
When used with SAS/GRAPH, you can choose whether to render the titles and footnotes as part of the body of the document or as part of the graphics image. Where the titles and footnotes are rendered determines how you control the font, size, and color of the titles and footnotes text. For details about this ODS and SAS/GRAPH interaction, see Controlling Titles and Footnotes in SAS/GRAPH: Reference.
For information about titles and footnotes rendered with and without using the graphics option USEGOPT, see ODS USEGOPT Statement.

Securing ODS Generated PDF Files

You can use the ODS PRINTER statement or the ODS PDF statement to generate PDF output. By default, PDF files are not password protected, so any user can view and edit the PDF files without restrictions. However, you can use SAS system options to restrict or allow users' ability to access, assemble, copy, or modify the ODS PDF files. Other SAS system options control whether the user can fill in forms and set the print resolution.
Setting the security of a PDF file involves setting an encryption level and setting PDF document properties. You use the following SAS system options to secure and configure document properties for PDF files:
PDF System Options and Associated PDF Document Properties
Action
System Option
Document Property
Specifies whether text and graphics from PDF documents can be read by screen readers for the visually impaired
PDFACCESS
Content Accessibility Enabled
Specifies whether PDF documents can be assembled
PDFASSEMBLY
Document Assembly
Specifies whether PDF document comments can be modified
PDFCOMMENT
Commenting
Specifies whether the contents of a PDF document can be changed
PDFCONTENT
Changing the Document
Specifies whether text and graphics from a PDF document can be copied
PDFCOPY
Content Copying
Specifies whether PDF forms can be filled in
PDFFILLIN
Form Field Fill-in or Signing
Specifies the password to use to open a PDF document and the password used by a PDF document owner
PDFPASSWORD=
Security Method
Document Open Password
Permissions Password
Specifies the resolution used to print the PDF document
PDFPRINT=
Printing
Specifies the level of encryption for PDF documents
PDFSECURITY=
Encryption Level
The PDF system options are documented in SAS System Options: Reference.
Note: The SAS/SECURE SSL software that is used to encrypt PDF files is included in the SAS installation software only for countries that allow the importation of encryption software.
You secure a PDF file by setting the PDFSECURITY= system option to an encryption level. Valid security levels for the PDFSECURITY= option are NONE, LOW, or HIGH. SAS sets the default PDF document properties based on the encryption level.
PDFSECURITY=NONE sets no encryption level or document property restrictions for the document. All of the PDF document properties are set to Allowed. Setting other PDF system options has no effect on PDF document properties when PDFSECURITY=NONE.
PDFSECURITY=LOW sets the encryption level to 40-bit RC4.
PDFSECURITY=HIGH sets the encryption level to 128-bit RC4.
When the PDFSECURITY= option is set to LOW or HIGH, you must specify one or more document passwords using the PDFPASSWORD= option. Passwords are required to open a secure document. An optional permissions password can be required to validate the document owner. Use the OPEN= "pw" argument to specify a password to open a document. Use the OWNER="pw" argument to specify a permissions password for the document owner.
To view the document properties for a PDF file, open the PDF file, right-click in the document, select Document Properties from the menu, and click Show Details. The Document Security window appears with the document property values.
Note: The Security tab in the Document Properties window displays the security settings. When PDFSECURITY=NONE, the Show Details button is inactive and the Document Restrictions Summary section displays the document property value of Allowed for all properties. If PDFSECURITY= is set to LOW or HIGH, ignore the Document Restrictions Summary section. The PDF document properties are displayed properly only from the Document Security window, which you access with the Show Details button..
The Yes and No values for the Document Open Password and the Permissions Password document properties indicate whether password security has been set for a document. These values are determined by the values of the PDFSECURITY= option and the PDFPASSWORD= option as shown in this table:
PDFPASSWORD=
PDFSECURITY=LOW
PDFSECURITY=HIGH
Security Method
Password Security
Password Security
Document Open Password
OPEN="pw"
OWNER="pw"
OPEN="pw" OWNER="pw"
Yes
No
Yes
Yes
No
Yes
Permissions Password
OPEN="pw"
OWNER="pw"
OPEN="pw" OWNER="pw"
No
Yes
Yes
No
Yes
Yes
Nearly all other document properties can be set to Allowed or Not Allowed by using other PDF system options. The Page Extraction property cannot be set by using a system option. To see how the individual options set the document properties, see the documentation for the PDF system options in SAS System Options: Reference. To see how the Page Extraction property is set, see Page Extraction Property Values by System Option.
The following table shows the default PDF document properties for the three values of the PDFSECURITY= option:
PDFSECURITY=NONE
PDFSECURITY=LOW 1
PDFSECURITY=HIGH 2
Printing
Allowed
High Resolution
High Resolution
Changing the Document
Allowed
Not Allowed
Not Allowed
Commenting
Allowed
Not Allowed
Not Allowed
Form Field Fill-in or Signing
Allowed
Not Allowed
Allowed
Document Assembly
Allowed
Not Allowed
Not Allowed
Content Copying
Allowed
Allowed
Allowed
Content Accessibility Enabled
Allowed
Allowed
Allowed
Page Extraction
Allowed
Allowed3
Allowed
Not Allowed when only PDFPASSWORD=(OWNER="pw") is specified
Encryption Level
None
40-bit RC4
128-bit RC4
1Documents that are created when PDFSECURITY=LOW can be viewed using Acrobat 3.0 and later.
2Documents that are created when PDFSECURITY=HIGH can be viewed using Acrobat 5.0 and later.
3SAS does not set the Page Extraction document property when PDFSECURITY=LOW. When you use PDFSECURITY=LOW, the Page Extraction value in the Document Security window is the last value that was set for the property when PDFSECURITY=HIGH.
Some document properties are set by SAS system options only when PDFSECURITY=HIGH. When you use the PDFCONTENT, PDFCOPY, PDFFILLIN, or the PDFPRINT= system options and PDFSECURITY=LOW, the resulting document properties might not be what you thought you set. For example, if PDFSECURITY=LOW and you set NOPDFCOPY, you might expect the Content Copying document property to be set to Not Allowed. The Document Security window displays the value Allowed because this was the value for the property when NOPDFCOPY was set.
The Page Extraction document property is set for different values of the PDF options, and only when PDFSECURITY=HIGH. The following table shows the Page Extraction document property values for the different PDF options and whether the document is opened by a user or by the owner:
Page Extraction Property Values by System Option
Option
Page Extraction when PDFSECURITY=HIGH
PDFPASSWORD=(OPEN="pw")
PDFPASSWORD=(OWNER="pw")
PDFACCESS
NOPDFACCESS
Allowed
Allowed
Not Allowed
Allowed
PDFASSEMBLY
NOPDFASSEMBLY
Not Allowed
Not Allowed
Allowed
Allowed
PDFCOMMENT
NOPDFCOMMENT
Not Allowed
Not Allowed
Not Allowed
Not Allowed
PDFCONTENT
NOPDFCONTENT
Not Allowed
Not Allowed
Allowed
Allowed
PDFCOPY
NOPDFCOPY
Not Allowed
Not Allowed
Allowed
Allowed
PDFFILLIN
NOPDFFILLIN
Not Allowed
Not Allowed
Allowed
Allowed
PDFPRINT=HRES
PDFPRINT=LRES
Not Allowed
Not Allowed
Allowed
Allowed