Chapter Contents

Previous

Next
The ODS Statements

ODS HTML Statement


Opens, manages, or closes the HTML destination. If the destination is open, you can create HTML output (output that is written in Hypertext Markup Language).

Featured in: Selecting Output for the HTML and Printer Destinations, Creating Output Data Sets, Using a Selection List with Multiple Procedure Steps, Creating a Separate Body File for Each Page of Output, and Appending to HTML Files


ODS HTML action;
ODS HTML HTML-file-specification(s) <option(s)>;

To do this ... Use this action
Close the HTML destination and any files that are associated with it CLOSE
Select output objects for the HTML destination SELECT
Exclude output objects from the HTML destination EXCLUDE
Write to the SAS log the current selection or exclusion list for the HTML destination SHOW

To do this ... Use this option
Specify the base name for the HTML anchor tag that identifies each output object in the current body file ANCHOR=
Specify a string to use as the first part of all links and references that ODS creates in the HTML files BASE=
Control the destination of the footnotes that are defined by the graphics program that generates the HTML output GFOOTNOTE | NOGFOOTNOTE
Specify the destination for all graphics output that is generated while the HTML destination is open GPATH=
Control the destination of the titles that are defined by the graphics program that generates the HTML output GTITLE | NOGTITLE
Specify HTML to place between the <HEAD> and </HEAD> tags in all the HTML files that the HTML destination writes to HEADTEXT=
Specify HTML to use as the <META> tag inside the <HEAD> and </HEAD> tags of all the HTML files that the HTML destination writes to METATEXT=
Create a new body file at the specified starting-point NEWFILE=
Specify the location (an external file or a SAS catalog) for all HTML files PATH=
Specify an alternative record separator for the HTML files RECORD_SEPARATOR
Specify the style definition to use in writing the HTML files STYLE=
Translate the HTML files to the requested represention TRANTAB=


Actions

An action takes some action regarding selection and exclusion lists, or closes the HTML destination. action can be one of the following:

CLOSE
closes the HTML destination and any files that are associated with it. When an ODS destination is closed, ODS does not send output to that destination. Closing an unneeded destination frees some system resources.
Featured in: Selecting Output for the HTML and Printer Destinations

EXCLUDE exclusion(s) | ALL | NONE
excludes output objects from the HTML destination.
Restriction: The HTML destination must be open for this action to take effect.
See also: ODS EXCLUDE Statement and How ODS Determines the Destinations for an Output Object

SELECT selection(s) | ALL | NONE
selects output objects for the HTML destination.
Restriction: The HTML destination must be open for this action to take effect.
See also: ODS SELECT Statement and How ODS Determines the Destinations for an Output Object

SHOW
writes to the SAS log the current selection or exclusion list for the HTML destination. If the list is the default list (SELECT ALL), SHOW also writes the current overall selection or exclusion list.
Restriction: The HTML destination must be open for this action to take effect.


Required Arguments

If you do not specify an action, you must use an HTML-file-specification.

HTML-file-specification
opens the HTML destination and specifies the HTML file or files to write to. These files remain open until you either

You can specify up to four HTML files to write to. The specifications for these files have the following form:
file-type=file-specification<(file-specification-suboption(s))>
where

file-type=file-specification
associates a type of HTML file with a particular file. file-type can be one of the following:

BODY=
identifies the file that contains the HTML output.
Alias: FILE=
Requirement: You cannot open the HTML destination without specifying a body file. Therefore, BODY= is required if the HTML destination is closed.
Featured in: Selecting Output for the HTML and Printer Destinations, Creating Output Data Sets, and Using a Selection List with Multiple Procedure Steps

CONTENTS=
identifies the file that contains a table of contents to the HTML output. The contents file links to the body file.
Featured in: Creating Output Data Sets and Using a Selection List with Multiple Procedure Steps

FRAME=
identifies the file that integrates the table of contents, the page contents, and the body file. If you open the frame file, you see a table of contents, a table of pages, or both, as well as the body file.
Restriction: If you specify FRAME=, you must also specify CONTENTS= or PAGE= or both.
Featured in: Creating Output Data Sets and Using a Selection List with Multiple Procedure Steps

PAGE=
identifies the file that contains a description of each page of the body file and links to the body file. ODS produces a new page of output whenever a procedure explicitly asks for a new page. The SAS system option PAGESIZE= has no effect on pages in HTML output.
Featured in: Creating Output Data Sets and Using a Selection List with Multiple Procedure Steps

file-specification identifies the file or SAS catalog to write to. It can be one of the following:

'external-file'
is the name of an external file to write to.
Featured in: Creating Output Data Sets and Using a Selection List with Multiple Procedure Steps

fileref
is a fileref that has been assigned to an external file. Use the FILENAME statement to assign a fileref. (For information on the FILENAME statement, see the section on statements in SAS Language Reference: Dictionary.)
Featured in: Appending to HTML Files

entry.HTML
specifies an entry in a SAS catalog to write to.
Interaction: If you specify an entry name, you must also specify a library and catalog. See the discussion of PATH=.

file-specification-suboptions
provide instructions for writing the HTML files. You specify these options inside parentheses next to the file-specification in the BODY=, CONTENTS=, PAGE=, or FRAME= option.

NO_BOTTOM_MATTER
By default, when you close a file that was open for HTML output, ODS writes some HTML to the bottom of the file. This HTML ends the file so that the HTML is valid and can be cleanly viewed in a browser.

If you wish to leave a body file in a state that you can append to with ODS, use NO_BOTTOM_MATTER with the file-specification in the BODY= option in the ODS HTML statement that opens the file. This option, in conjunction with NO_TOP_MATTER, makes it possible for you to add output to a file that already exists and to put your own HTML code in the file between output objects.
Alias: NOBOT
Interaction: When you are opening a file that ODS has previously written to, you must use ANCHOR= to specify a new base name for the anchors to avoid duplicating anchors that already exist in the file (see the discussion of ANCHOR=).
Tip: Appending to an external file requires that you use a FILENAME statement with the appropriate option for the host operating environment.
See also: NO_TOP_MATTER
Featured in: Appending to HTML Files

NO_TOP_MATTER
By default, when you open a file to create HTML output, ODS writes some HTML to the top of the file.

If ODS has already written to the body file that you are opening, you must open the file with NO_TOP_MATTER in the file-specification in the BODY= option in the ODS HTML statement that opens the file. This suboption, in conjunction with NO_BOTTOM_MATTER, makes it possible for you to add output to a file that already exists and to put your own HTML code in the file between output objects.
Alias: NOTOP
Interaction: When you are opening a file that ODS has previously written to, you must use ANCHOR= to specify a new base name for the anchors to avoid duplicating anchors that already exist in the file (see the discussion of ANCHOR=).
Tip: Appending to an external file requires that you use a FILENAME statement with the appropriate option for the host operating environment.
See also: NO_BOTTOM_MATTER
Featured in: Appending to HTML Files

URL='Uniform-Resource-Locator'
provides a URL for file-specification. ODS uses this URL instead of the file name in all the links and references that it creates that point to the file.
Tip: This option is useful for building HTML files that may be moved from one location to another. If the links from the contents and page files are constructed with a simple URL (one name), they work as long as the contents, page, and body files are all in the same location.
Tip: You never need to specify this suboption with FRAME= because no ODS file references the frame file.
See also: HTML Links and References

DYNAMIC
enables you to send HTML output directly to a web server instead of writing it to a file. This option sets the value of the HTMLCONTENTTYPE= attribute.
Default: If you do not specify DYNAMIC, ODS sets the value of HTMLCONTENTTYPE= for writing to a file.
Restriction: If you specify the DYNAMIC suboption with any file specification in the ODS HTML statement, you must specify it for all the file specifications in the statement.

Interaction: HTML-file-specification is required if the HTML destination is closed.


Options

ANCHOR='anchor-name'
specifies the base name for the HTML anchor tag that identifies each output object in the current body file. Each output object must have an anchor tag for the contents, page, and frame files to link to or to reference. The links and references, which are automatically created by ODS, point to the name of an anchor. Therefore, each anchor name in a file must be unique.

ODS creates unique anchor names by incrementing the name that you specify. For example, if you specify ANCHOR='tabulate', ODS names the first anchor tabulate. The second anchor is named tabulate1; the third is named tabulate2, and so on.

You can change anchor names as often as you like by submitting the ANCHOR= option in an ODS HTML statement anywhere in your program. Once you have specified an anchor name, it remains in effect until you specify a new one.
Default: IDX
Interaction: If you open an HTML file to append to it, be sure to specify a new anchor so that you don't write the same anchors to the file again. ODS cannot know about anchors that are already in a file when it opens the file.
Tip: Specifying new anchor names at various points in your program is useful when you want other web pages to link to specific parts of your HTML output. Because you can control where the anchor name changes, you know ahead of time what the anchor name will be at those points.
See also: How ODS Constructs Links and References
Featured in: Appending to HTML Files

BASE='string'
Specifies a string to use as the first part of all links and references that ODS creates in the HTML files. Consider this specification:
BASE='http://www.your-company.com/local-url/'
In this case, ODS creates links that begin with the string http://www.your-company.com/local-url/. The appropriate anchor-name completes the link.
See also: How ODS Constructs Links and References
Featured in: Creating a Separate Body File for Each Page of Output

GFOOTNOTE | NOGFOOTNOTE
controls the destination of the footnotes that are defined by the graphics program that generates the HTML output. GFOOTNOTE includes all the currently defined footnotes within the graphics output (the GIF file) that is called by the body file. NOGFOOTNOTE suppresses all the currently defined footnotes from appearing in the GIF files. Instead, they become part of the body file.
Default: GFOOTNOTE
Restriction: Footnotes that are displayed by ODS HTML support most SAS/GRAPH FOOTNOTE statement options. The font must be valid for the browser. Options that ODS cannot handle, such as height and text angle specifications, are ignored. For details, see "TITLE, FOOTNOTE, and NOTE Statements" in "SAS/GRAPH Statements" in SAS/GRAPH Software: Reference.
Restriction: This option applies only to SAS programs that produce one or more GIF files.

GPATH=file-specification <(url='Uniform-Resource-Locator' | NONE)>
specifies the destination for all graphics output that is generated while the HTML destination is open.

file-specification
identifies the file or SAS catalog to write to. If you specify a file, it should be an aggregate storage location, such as a directory or partitioned data set. Each output object that ODS places in the file is named automatically using the SAS/GRAPH catalog entry name as the base name and incrementing the name as necessary. For more information on how ODS names catalog entries and external files, see "ODS HTML Statement" in "SAS/GRAPH Statements" in SAS/GRAPH Software: Reference.

file-specification can be one of the following:

'external-file'
is the name of an external file to write to.

fileref
is a fileref that has been assigned to an external file. Use the FILENAME statement to assign a fileref. (For information on the FILENAME statement, see the section on statements in SAS Language Reference: Dictionary).
Interaction: If you use a fileref in the GPATH= option, ODS does not use information from GPATH= when it constructs links. (See How ODS Constructs Links and References.)

libref.catalog
specifies a SAS catalog to write to.

URL='Uniform-Resource-Locator' | NONE
provides a URL for file-specification. ODS uses this URL instead of the file name in all the links and references that it creates to the file. If you specify the keyword NONE, no information from the GPATH= option appears in the links or references.
Tip: This option is useful for building HTML files that may be moved from one location to another. If the links from the contents and page files are constructed with a simple URL (one name), they will work as long as the contents, page, and body files are all in the same location.
See also: How ODS Constructs Links and References
Featured in: Creating a Separate Body File for Each Page of Output

Default: If you omit GPATH=, ODS stores graphics in the location that is specified by PATH=. (See the discussion of PATH=.) If you do not specify PATH=, ODS stores the graphics in the current directory.

GTITLE | NOGTITLE
controls the destination of the titles that are defined by the graphics program that generates the HTML output. GTITLE includes all the currently defined titles within the graphics output that is called by the body file. NOGTITLE suppresses all the currently defined titles from appearing in the graphics output. Instead, they become part of the body file.
Default: GTITLE
Restriction: Titles that are displayed by ODS HTML support most SAS/GRAPH TITLE statement options. The font must be valid for the browser. Options that ODS cannot handle, such as height and text angle specifications, are ignored. For details, see "TITLE, FOOTNOTE, and NOTE Statements" in "SAS/GRAPH Statements" in SAS/GRAPH Software: Reference.
Restriction: This option applies only to SAS programs that produce one or more GIF files.

HEADTEXT='HTML-for-document-head'
specifies HTML to place between the <HEAD> and </HEAD> tags in all the HTML files that the HTML destination writes to. Use HEADTEXT= to define programs (for example, java scripts) that you can use later in the file.
Tip: ODS cannot parse the HTML that you supply. It should be well-formed HTML that makes sense in the context of the <HEAD> and </HEAD> tags. For information on HTML, refer to one of the many reference books that are available on the subject.

METATEXT='HTML-for-document-head'
specifies HTML to use as the <META> tag between the <HEAD> and </HEAD> tags of all the HTML files that the HTML destination writes to. This HTML provides the browser with information about the document that it is loading. This information could include things like the content-type and the character set to use. For information on HTML, refer to one of the many reference books that are available on the subject.
Default: If you do not specify METATEXT=, ODS writes a simple <META> tag, which includes the content-type of the document and the character set to use, to all the HTML files that it creates.
Tip: ODS cannot parse the HTML that you supply. It should be well-formed HTML that makes sense in the context of the <HEAD> tags. If you are using METATEXT= as it is intended, your HTML should look like this:
<META your-metatext-which-could-be-very-long>

NEWFILE=<starting-point>
creates a new body file at the specified starting-point. ODS automatically names new files by incrementing the name of the body file. For example, if you specify BODY='REPORT.HTML', ODS names the first body file REPORT.HTML. Additional body files are named REPORT1.HTML, REPORT2.HTML, and so forth. If you end the file name with a digit, ODS begins incrementing with that digit. For instance, if you specify BODY='MAY5.HTML', ODS names the first body file MAY5.HTML. Additional body files are named MAY6.HTML, MAY7.HTML, and so forth.

starting-point can be one of the following:

NONE
writes all output to the body file that is currently open.

OUTPUT
starts a new body file for each output object. For SAS/GRAPH this means that ODS creates a new file for each GRSEG or GIF file that the program generates.
Alias: TABLE

PAGE
starts a new body file for each page of output. A page break occurs when a procedure explicitly starts a new page (not because the page size was exceeded) or when you start a new procedure.

PROC

starts a new body file each time that you start a new procedure.

Default: NONE
Featured in: Creating a Separate Body File for Each Page of Output

NOGFOOTNOTE
See the discussion of GFOOTNOTE | NOGFOOTNOTE.

NOGTITLE
See the discussion of GTITLE | NOGTITLE.

PATH=file-specification<(URL='Uniform-Resource-Locator' | NONE)>
specifies the location (an external file or a SAS catalog) for all HTML files.

file-specification
identifies the file or SAS catalog to write to. If you specify a file, it should be an aggregate storage location, such as a directory or partitioned data set.

file-specification can be one of the following:

'external-file'
is the name of an external file to write to.

fileref
is a fileref that has been assigned to an external file. Use the FILENAME statement to assign a fileref. (For information on the FILENAME statement, see the section on statements in SAS Language Reference: Dictionary).
Interaction: If you use a fileref in the PATH= option, ODS does not use information from PATH= when it constructs links. (See How ODS Constructs Links and References.)

libname.catalog
specifies a SAS catalog to write to.

URL='Uniform-Resource-Locator' | NONE
provides a URL for file-specification. ODS uses this URL instead of the file name in all the links and references that it creates to the file. If you specify the keyword NONE, no information from the PATH= option appears in the links or references.
Tip: This option is useful for building HTML files that may be moved from one location to another. If the links from the contents and page files are constructed with a simple URL (one name), they work as long as the contents, page, and body files are all in the same location.
See also: How ODS Constructs Links and References
Featured in: Creating a Separate Body File for Each Page of Output

RECORD_SEPARATOR='string' | NONE
specifies an alternative record separator for the HTML files. A record separator is the character or string that separates lines in the HTML files.

Different operating environments use different separator characters. If you don't specify a record separator, the HTML files are formatted for the environment that you run the SAS job in. However, if you are generating files in one operating environment for viewing in another operating environment that uses a different separator character, you can specify a record separator that is appropriate for the target environment.

'string'
is the hexadecimal representation of one or more characters. For example, the following option specifies a record-separator of a carriage-return character and a linefeed character (on an ASCII file system):
RECORD_SEPARATOR='0D0A'x

NONE
produces HTML that is appropriate for the environment that you run the SAS job in. In many operating environments, using a value of NONE is the same as omitting the RECORD_SEPARATOR option. However, in mainframe operating environments, it is not.

Operating Environment Information:   In a mainframe environment, by default, ODS produces a binary file that contains embedded record-separator characters. While this approach means that the file is not restricted by the line-length restrictions on ASCII files, it also means that if you view the file in an editor, the lines all run together.

If you want to format the HTML files so that you can read them with an editor, use RECORD_SEPARATOR=NONE. In this case, ODS writes one line of HTML at a time to the file. When you use a value of NONE, the logical record length of the file that you are writing to must be at least as long as the longest line that ODS produces. If it isn't, the HTML may wrap to another line at an inappropriate place.  [cautionend]

Alias:
RECSEP=
RS=

STYLE='style-definition'
specifies the style definition to use in writing the HTML files. For more information, see Style Definitions, Style Elements, and Style Attributes.
Default: If you do not specify a style definition, ODS uses the file that is specified in the SAS registry subkey

ODS
[arrow]
PREFERENCES
[arrow]
HTML
[arrow]
Selected Style
By default, this value specifies styles.default.

Featured in: Appending to HTML Files

TRANTAB='translation-table'
translates the HTML files to the requested represention. This option is particularly useful if you are creating files, for example, on an EBCDIC-based operating system and if the files are destined for an ASCII-based web server. If you use TRANTAB=, you can transfer the files in binary mode because they are already in the appropriate representation. (SAS facilities for changing translation tables are much more flexible than those of FTP, for example.)

translation-table can be any translation table that SAS provides or any user-defined translation table.
See also: For information on translation tables, see the documentation of the TRANTAB= system option in the section on system options in SAS Language Reference: Dictionary.

For information on creating, editing, and displaying customized translation tables, see "The TRANTAB Procedure" in SAS Procedures Guide. You can also use PROC TRANTAB to view and modify translation tables that are supplied by SAS Institute.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.