Chapter 5: Dictionary of ODS Language Statements


FILE Statement for ODS

Creates an ODS output object by binding the data component to the table definition (template). Optionally, lists the variables to include in the ODS output, and specifies options that control the way that the variables are formatted.

Valid: in a DATA step

Category: File-handling

Type: Executable

Default: ODS sends the output object to all open ODS destinations.

Syntax

FILE PRINT ODS <=( ODS-suboption(s) )>< options >;

Note: This syntax shows only the ODS form of the FILE statement. For the complete syntax, see the FILE statement in SAS Language Reference: Dictionary .

Required Arguments

PRINT

  • is a reserved fileref that you must use when you direct output to ODS.

  • Requirement: You must use PRINT in a FILE statement that uses the ODS option.

  • Featured in: Example 1: Creating a Report with the DATA Step and the Default Table Definition in SAS Output Delivery System: User s Guide

ODS<=( ODS-suboptions )>

  • Defines the structure of the data component and binds the data component to a table definition. The result is an ODS output object. ODS sends this object to all open ODS destinations.

  • See Also: For information about the ODS suboptions, see ODS Suboptions on page 69.

  • Featured in: All examples

Options

N= number

  • specifies the number of lines that are available to the output pointer in the current iteration of the DATA step.

overflow-control

  • determines the PUT statement behavior when the output pointer attempts to move past the last ODS column in the buffer.

    overflow-control is one of the following:

  • DROPOVER

    • discards items when a PUT statement attempts to write beyond the last ODS column in the buffer. A message in the log at the end of the DATA step informs you if data were not written to the buffer.

  • FLOWOVER

    • moves the output pointer to a new line if a PUT statement attempts to write an item beyond the last ODS column in the buffer. The PUT statement writes the next item in the first ODS column of the new line.

  • STOPOVER

    • stops processing the DATA step immediately if a PUT statement attempts to write beyond the last ODS column in the buffer. SAS discards the data item, writes the portion of the buffer that was built before the error occurred, and issues an error message.

  • Default: FLOWOVER

Without ODS Suboptions

If you do not specify any ODS suboptions, then the DATA step uses a default table definition (BASE.DATASTEP.TABLE) that is stored in the SASHELP.TMPLMST template store. This definition defines two generic columns: one for character variables and one for numeric variables. ODS associates each variable in the DATA step with one of these columns and displays the variables in the order in which they are defined in the DATA step.

If there are no suboptions, the default table definition uses the variable s label as its column header. If no label exists, then the definition uses the variable s name as the column header.

ODS Suboptions

Task

Suboption

Specify one or more columns for the data component

COLUMNS= or VARIABLES=

Specify default values for column attributes that exist in the table definition, but that get their values from the data component

DYNAMIC=

Specify whether all column definitions in the table definition can be used by more than one variable

GENERIC=

Specify a column header to use for any column that does not have a column header specified in the COLUMNS= or VARIABLES= suboption

LABEL=

Specify a name for the output object that the DATA step produces

OBJECT=

Specify a label for the output object that the DATA step produces

OBJECTLABEL=

Specify the table definition to use with the data component to produce the output object

TEMPLATE=

COLUMNS=( column-specification(s) )

  • specifies one or more columns for the data component and determines their order in the data component.

  • Restriction: You can use only one COLUMNS= suboption in a FILE PRINT ODS statement.

  • Restriction: You can use either the COLUMNS= suboption or the VARIABLES= suboption, but not both, in a single FILE PRINT ODS statement.

  • Requirement: You must enclose column-specification(s) in parentheses.

  • Tip: The order of the columns in the output object is determined by their order in the table definition, not by their order in the data component.

  • Tip: You can override the default order by using the ORDER_DATA= table attribute in the PROC TEMPLATE step that creates the definition. The default DATA step table definition uses this attribute. For more information see the discussion of ORDER_DATA= on page 419 table attribute.

  • Tip: If you do not specify COLUMNS= or VARIABLES=, then the order of columns in the data component matches the order of the corresponding variables in the program data vector.

  • Each column-specification associates a DATA step variable with a column that is defined in the table definition. column-specification has this general form:

    • ( column-name-1 <= variable-name-1 <( attribute-suboptions )>> <. . .

      • column-name-n <= variable-name-n <( attribute-suboptions )>>>)

  • column-name

    • is the name of a column. This name must match the name that is defined in the table definition that you use.

    • Restriction: column-name must conform to the rules for SAS variable names . For information see the SAS Language Reference: Dictionary .

    • Requirement: You must enclose column-name in parentheses.

    • Tip: You can use list notation (for example, score1 - score5 ) to specify multiple column names.

    • Featured in: Example 4: Creating and Using a User-Defined Table Definition Template in SAS Output Delivery System: User s Guide

  • variable-name

    • specifies a variable in the DATA step to place in the specified column.

    • Default: If you omit variable-name , then ODS looks for a DATA step variable named column-name to place in the specified column. If no such variable exists, then ODS returns an error.

    • Tip: You can use list notation (for example, score1 - score5 ) to specify a range of variable names.

    • Featured in: Example 4: Creating and Using a User-Defined Table Definition Template in SAS Output Delivery System: User s Guide

  • ( attribute-suboptions )

    • assigns a characteristic, such as a label or a format, to a particular column in the data component. These individual specifications override any attributes that is set by the DATA step.

    • The following table lists the attribute suboptions that are available for the COLUMNS= suboption. For a complete description, see Attribute Suboptions on page 75.

      Task

      Suboption

      Specify a value for a column attribute that exists in the table definition, but that gets its value from the data component

      DYNAMIC=

      Specify a format for the current column

      FORMAT=

      Specify whether the DATA step uses this column definition for multiple variables

      GENERIC=

      Specify a label for a particular column

      LABEL=

  • Requirement: You must enclose attribute-suboptions in parentheses.

DYNAMIC=( dynamic-specification(s) )

  • specifies default values for dynamic attribute values.

    A dynamic attribute value is defined in the table definition. Its name serves as a placeholder for the value that is supplied to the data component with the DYNAMIC= suboption. When ODS creates the output object from the table definition and the data component, it substitutes the appropriate value from the data component for the value s name in the table definition.

    Each dynamic-specification has the following form:

  • dynamic-value-name <= variable-name | constant >

  • dynamic-value-name

    • is the name that the table definition gives to a dynamic attribute value.

  • variable-name

    • specifies a variable whose value is assigned to dynamic-value-name and passed to ODS to substitute for the placeholder in the table definition when it creates the output object.

  • constant

    • specifies a constant to assign to dynamic-value-name and to pass to ODS to substitute for the placeholder in the table definition when it creates the output object.

  • Default: By default, the DYNAMIC= suboption applies to all columns in the data component.

  • Interaction: Columns that do not contain their own DYNAMIC= suboption specifications use these dynamic-specifications .

  • Tip: You can override the default specification for an individual column by specifying the DYNAMIC= suboption as an attribute for that column in the COLUMNS= or the VARIABLES= suboption.

GENERIC=ON | OFF

  • indicates whether the DATA step uses all column definitions for multiple variables.

  • ON

    • indicates whether the DATA step uses all column definitions for multiple variables.

  • OFF

    • indicates whether the DATA step uses no column definitions for multiple variables.

  • Default: OFF

  • Default: By default, the GENERIC= suboption applies to all columns in the data component.

  • Restriction: ODS does not recognize the column names as a match unless you specify the (COLUMNS=(GENERIC=ON)) suboption.

  • Interaction: If you do not specify a table definition, then the GENERIC= suboption is set to ON.

  • Tip: You can override the default specification for an individual column by specifying the GENERIC= suboption as an attribute for that column in the COLUMNS= or the VARIABLES= suboption.

LABEL= column-label

  • specifies a label for any column that does not have a label specified in the COLUMNS= or VARIABLES= suboption.

  • Default: If you use the LABEL= suboption, then ODS uses the first of these labels that it finds:

    • a label that is specified with HEADER= attribute for a particular column in the table definition (see HEADER= on page 382 column attribute).

    • a label that is specified for a particular column with LABEL= suboption in the COLUMNS= or VARIABLES= suboption

    • a label that is specified with LABEL= suboption in the ODS= option

    • a label that is assigned with the LABEL statement in the DATA step.

  • Tip: If you omit the LABEL= suboption, then the contents of the table definition determines whether the column header contains the variable name or is blank.

  • Featured in: Example 3: Assigning Attributes to Columns in ODS Output in SAS Output Delivery System: User s Guide

OBJECT= object-name

  • specifies a name for the output object.

    The Results window and the HTML contents file both contain a description of, and a link to, each output object. The description contains the first of the following items that ODS finds:

    • the object s label

    • the current title if it is not the default title, The SAS System

    • the object s name

    • the string FilePrint # , where # increases by 1 for each DATA step that you run in the current SAS process without specifying an object name or an object label.

  • Restriction: object-name must conform to the rules for SAS variable names. For information about these rules, see Rules for Words and Names in the SAS Language in SAS Language Reference: Concepts .

OBJECTLABEL= object-label

  • specifies a label for the output object.

  • The Results window and the HTML contents file both contain a description of, and a link to, each output object. The description contains the first of the following items that ODS finds:

  • the object s label

  • the current title if it is not the default title, The SAS System

  • the object s name (see OBJECT= on page 72)

  • the string FilePrint # , where # increases by 1 for each DATA step that you run in the current SAS process without specifying an object name or an object label.

TEMPLATE= table-definition-name

  • specifies the table definition to use with the data component to produce the output object.

  • table-definition-name

    • is the path to the table definition. SAS stores a table definition as an item in an item store.

  • Default: If you do not specify the TEMPLATE= option, ODS uses BASE.DATASTEP.TABLE, the default table definition.

  • Default: If you do specify the TEMPLATE= suboption, ODS first looks for table-definition-name in SASUSER.TEMPLAT, and then it looks in SASHELP.TMPLMST.

  • Requirement: You must enclose table-definition-name in quotation marks.

  • Interaction: When you use the default table definition, the GENERIC= suboption is set to ON for all columns in the data component. For more information see GENERIC= on page 72.

  • Tip: When you use the BASE.DATASTEP.TABLE template, character values are left-justified. If you want character values to be right-justified, specify the BASE.DATASTEP.TABLENOJUST template.

  • Tip: You can change the locations that ODS searches for the table-definition-name by using the ODS PATH Statement on page 149.

  • Featured in: Example 4: Creating and Using a User-Defined Table Definition Template in SAS Output Delivery System: User s Guide

VARIABLES=( variable-specification(s) )

  • specifies one or more columns for the data component of the output object. Each variable-specification associates a DATA step variable with a column that is defined in the table definition. The variable-specification value has this general form:

    • ( variable-name-1 <= column-name-1 <( attribute-suboptions )>> <. . .

      • variable-name-n <= column-name-n <( attribute-suboptions )>>>)

  • variable-name

    • specifies a variable in the DATA step to use as a column in the data component.

    • Tip: You can use list notation (for example, score1 - score5 ) to specify a range of variable names.

    • Featured in: Example 2: Producing ODS Output That Contains Selected Variables and Example 3: Assigning Attributes to Columns in ODS Output in SAS Output Delivery System: User s Guide

  • column-name

    • is the name of a column. This name must match a name that is defined in the table definition.

    • Default: If you are using the default table definition and you omit column-name , then ODS uses the variable label to name the column. If the variable has no label, then ODS uses the variable name.

    • Default: If you using a table definition other than the default table definition and you omit column-name , then ODS looks in the table definition for a column that is named variable-name and places the variable in that column. If no such column exists, then ODS returns an error.

    • Restriction: column-name must match a column name in the table definition that you are using. It must also conform to the rules for SAS variable names. For information about these rules, see Rules for Words and Names in the SAS Language in SAS Language Reference: Concepts .

    • Tip: You can use list notation (for example, score1 - score5 ) to specify a range of column names.

  • ( attribute-suboptions )

    • assigns a characteristic, such as a label or a format, to a particular column in the data component. These individual specifications override any attributes that are set in the DATA step for the entire data component.

    • The following table lists the attribute suboptions available for the VARIABLES= suboption. For a complete description, see Attribute Suboptions on page 75.

      Task

      Suboption

      Specify a value for a column attribute that exists in the table definition, but that gets its value from the data component

      DYNAMIC=

      Specify a format for the current column

      FORMAT=

      Specify whether the DATA step uses this column definition for multiple variables

      GENERIC=

      Specify a label for a particular column

      LABEL=

  • Default: If you specify the VARIABLES= suboption, then the order of the columns in the output object is determined by their order in the table definition, not by their order in the data component. If you do not specify COLUMNS= or VARIABLES= suboptions, then the order of columns in the data component matches the order of the corresponding variables in the program data vector.

  • Restriction: You can use only one VARIABLES= suboption in a FILE PRINT ODS statement.

  • Restriction: You can use either the COLUMNS= suboption or the VARIABLES= suboption to associate variables with columns. However, you cannot use both suboptions in the same FILE PRINT ODS statement.

  • Tip: You can override the default order by using the ORDER_DATA table attribute in the PROC TEMPLATE step that creates the definition. The default DATA step table definition uses this attribute. For more information see the ORDER_DATA= on page 419 table attribute.

  • Tip: The VARIABLES= suboption is primarily for use with the default DATA step table definition. When you are using the default definition, the DATA step can map variables to the appropriate column in the definition so you do not need to specify a column name.

  • Featured in: Example 2: Producing ODS Output That Contains Selected Variables and Example 3: Assigning Attributes to Columns in ODS Output in SAS Output Delivery System: User s Guide .

Attribute Suboptions

DYNAMIC= dynamic-specification(s)

  • specifies a value for a column attribute that exists in the table definition, but that get its value from the data component.

  • Main discussion: DYNAMIC= on page 71

  • Featured in: Example 4: Creating and Using a User-Defined Table Definition Template in SAS Output Delivery System: User s Guide

FORMAT= format-name

  • specifies a format for the current column.

  • Default: ODS uses the first of these formats for the variable that it finds:

    • for nongeneric columns, a format that is specified in the column definition

    • a format that is specified in the FORMAT= column attribute

    • a format that is specified in a FORMAT statement

    • the default format ($ w . for character variables; BEST12. for numeric variables).

  • Featured in: Example 4: Creating and Using a User-Defined Table Definition Template in SAS Output Delivery System: User s Guide

  • Note: Formats for generic columns that are specified in the table definition are ignored by the DATA step interface to ODS.

GENERIC=ON|OFF

  • specifies whether the DATA step uses this column definition for multiple variables.

  • Default: OFF

  • Main discussion: GENERIC= on page 72

  • Featured in: Example 4: Creating and Using a User-Defined Table Definition Template in SAS Output Delivery System: User s Guide

LABEL= column-label

Details

The following restrictions apply to the FILE statement when you use it with ODS:

  • These arguments affect only listing output:

    • FOOTNOTES and NOFOOTNOTES

    • LINESIZE

    • PAGESIZE

    • TITLE and NOTITLES

  • Do not use these arguments:

    • DELIMITER=

    • DSD

    • _FILE_=

    • FILEVAR=

    • HEADER=

    • PAD

See Also

Statement:

  • PUT Statement for ODS on page 80

Output Delivery System and the DATA Step in SAS Output Delivery System: User s Guide

Examples in SAS Output Delivery System: User s Guide

LIBNAME Statement, SASEDOC

Uses the SASEDOC engine to associate a SAS libref (library reference) with one or more ODS output objects that are stored in an ODS document

Valid: Anywhere

Category: ODS: Output Control

Restriction: The LIBNAME statement used with the SASEDOC engine provides read access to an output object. You cannot write an output object to a library with the SASEDOC engine. However, you can delete or rename a data set.

Syntax

LIBNAME libref SASEDOC path <sasedoc-engine-option> < options >;

Arguments

libref

  • is a shortcut name or a "nickname" for the aggregate storage location where your SAS files are stored. It is any SAS name that you choose for assigning a new libref. When you are disassociating a libref from a SAS data library, or when you are listing attributes, specify a libref that was previously assigned or else use the CLEAR argument.

  • Tip: The association between a libref and a SAS data library lasts only for the duration of the SAS session or until you change it or discontinue it with another LIBNAME statement for the same libref.

SASEDOC

  • is the name of the engine that associates a SAS libref (library reference) with one or more ODS output objects that are stored in an ODS document.

path

  • is the fully specified location of an ODS document directory.

SASEDOC Engine Option

DOC_SEQNO= sequence-number

  • permits you to specify the sequence number of the output object to be accessed. This is necessary when multiple output objects that are in the same directory have the same name. By default, the SASEDOC libname engine can access only the most recently created output object, which might not be the one that you want to access. Specify DOC_SEQNO to override the default.

Additional LIBNAME Statement Arguments and Options

For additional arguments and options that are valid for the LIBNAME statement, see the LIBNAME statement in SAS Language Reference: Dictionary .

Details

Using the LIBNAME Statement The SASEDOC libname engine permits you to access output objects that are stored in an ODS document. A data set that is accessed by using the SASEDOC libname engine might differ structurally from one created by replaying the ODS document output object to the ODS OUTPUT destination. This is because the ODS OUTPUT destination recognizes the output object s template, but the SASEDOC LIBNAME engine does not.

Examples
Example 1: Assigning a LIBNAME to an ODS DOCUMENT
  • LIBNAME statement

    • Option:

      • DOC_SEQNO=

  • ODS DOCUMENT statement

    • Option:

      • NAME=

  • Other SAS features:

    • PROC DATASETS

    • PROC GLM

    • PROC PRINT

Program Description This example assigns a libname to an ODS document directory that contains four output objects created by PROC GLM. The four output objects are tables:

  • Overall ANOVA

  • Fit statistics

  • Type I model ANOVA

  • Type III model ANOVA

Program

Create the ODS document sasuser.odsglm and open the DOCUMENT destination. The ODS DOCUMENT statement opens the document destination. The NAME= option assigns the name sasuser.odsglm to the ODS document that will contain the output from the PROC GLM program. The access-option WRITE provides write access to the document. Note that odsglm will be created in the SASUSER library.

ods document name=sasuser.odsglm(write); 

The plant_stats data set contains the statistical information that PROC GLM uses to create the output objects.

data plant_stats;    do month = 1 to 12;      age  = 2 + 0.3*rannor(345467);      age2 = 3 + 0.3*rannor(345467);      age3 = 4 + 0.4*rannor(345467);      output;    end;  run; 

Create the output objects. The GLM procedure creates the output objects. For information about viewing a record of each output object that is created, see the ODS TRACE statement in SAS Output Delivery System: User s Guide .

proc glm;    class month;    model age age2 age3=month / nouni;    manova h=month /printe;  run; 

The plants data set contains the statistical information that PROC GLM uses to create the output objects.

data plants;     input type $ @;     do block=1 to 3;        input stemleng @;        output;     end;     datalines;     clarion  32.7 32.3 31.5     clinton  32.1 29.7 29.1     knox     35.7 35.9 33.1     oneill  36.0 34.2 31.2     compost  31.8 28.0 29.2     wabash   38.2 37.8 31.9     webster  32.5 31.1 29.7     ;  run; 

Create the output objects. The GLM procedure creates the output objects. For information about viewing a record of each output object that is created, see the ODS TRACE statement in SAS Output Delivery System: User s Guide .

proc glm order=data;     class type block;     model stemleng=type block;     means type;     contrast 'compost vs others'  type 1 1 1 1  6 1 1;     contrast 'river soils vs.non' type 1 1 1 1  0  5 1,                                   type 1  4 1 1  0  0 1;     contrast 'glacial vs drift'   type 1  0  1  1  0  0 1;     contrast 'clarion vs webster' type 1  0  0  0  0  0  1;     contrast 'knox vs oneill'     type  0  0  1 1  0  0  0;  quit; 

Close the DOCUMENT destination. If you do not close the DOCUMENT destination, you will be unable to see DOCUMENT procedure output.

ods document close; 

Associate the libref mylib with the directory stemleng . The LIBNAME statement uses the SASEDOC engine to associate the SAS libref mylib with the directory stemleng that is stored in the ODS document sasuser.odsglm . Notice that the path includes anova#1 and not just anova . This is because there are two anova directories, and this code is specifying the first directory. If the sequence number was omitted, then ODS would associate the libref with the second directory.

libname mylib sasedoc "\sasuser.odsglm\glm\anova#1\stemleng"; 

The LIBRARY= option specifies mylib as the procedure input library. The QUIT statement stops the DATASETS procedure.

proc datasets lib=mylib;  run;  quit; 

Print the data sets. Since two output objects have the same name (ModelANOVA), the SASEDOC libname engine recognizes only the second table, because it was created more recently than the first table. The DOC_SEQNO= data set option specifies a sequence number of 1 in order to access the first table .

proc print data=mylib.modelanova;  run; 
proc print data=mylib.modelanova(doc_seqno=1);  run; 

Output

The following display shows the Explorer window that contains the SAS library Mylib which is associated with the directory stemleng . The stemleng directory is stored in the ODS document sasuser.odsglm .

Click To expand
Display 5.1: Explorer Window

The following display shows the Explorer window that contains the contents of the SAS library Mylib . The three output objects are actually stored in an ODS document.

Click To expand
Display 5.2: The Contents of Mylib
See Also

Procedures:

Statements:

PUT Statement for ODS

Writes data values to a special buffer from which they can be written to the data component and then formatted by ODS

Valid: in a DATA step

Category: File-handling

Type: Executable

Requirement: If you use the _ODS_ option in the PUT statement, then you must use the FILE PRINT ODS statement.

Syntax

PUT < specification ><_ODS_><@|@@>;

Note: This syntax shows only the ODS form of the PUT statement when you are binding to a template. For the complete syntax, see the PUT statement in SAS Language Reference: Dictionary .

Options

specification

  • specifies one or more variables to write and where to write them. Specification has the following form:

    • ods-pointer-control-1 > variable-1 <...< ods-pointer-control-n > variable-n >

  • ods-pointer-control

    • moves the pointer in the buffer to a specified line or column.

    • See also: When the Pointer Moves Past the End of a Line on page 83

_ODS_

  • specifies that the PUT statement writes values to the data component for each of the variables that were defined as columns with the FILE PRINT ODS COLUMNS= statement.

  • Default: The order of these columns is determined by the order that is specified by the COLUMNS= suboption in the FILE PRINT ODS statement. If you omit the COLUMNS= suboption, then the order of the variables in the program data vector determines their order in the output object.

  • Requirement: If you specify the _ODS_ option, then you must use the FILE PRINT ODS statement and the FILE PRINT ODS statement must precede the PUT _ODS_ statement. For more information, see ODS<=(ODS-suboptions)> on page 68.

  • Interaction: You can use _ODS_ in a PUT statement that specifies the placement of individual variables. _ODS_ writes to a particular row and column only if another PUT statement has not already written a variable to that same row and column. The position of _ODS_ in the PUT statement does not affect the outcome in the data component.

  • Tip: By default, the order of the columns in the data component matches the order of the columns in the buffer. However, if you have specified a table definition, it might override this order. For more information, see the discussion of the ORDER_DATA= on page 419 in the TEMPLATE procedure section.

@ | @@

  • holds an output line for the execution of the next PUT statement across iterations of the DATA step. The line-hold specifiers are called trailing @ and double trailing @ .

  • Default: If you do not use @ or @@, then each PUT statement in a DATA step writes a new line to the buffer.

  • Main discussion: When the Pointer Moves Past the End of a Line on page 83

Details

ODS Column Pointer Controls ODS column pointer controls differ slightly from column pointer controls in a PUT statement that does not use ODS. An ODS column refers not to a single character space but to a column that contains an entire variable value. Therefore, an ODS column pointer control moves from one entire value to the next, not from one character space to another. Column 1 contains values for the first variable in the output; column 2 contains values for the second variable, and so on.

ODS column pointer controls have the following general forms:

@ ods-column

  • moves the pointer to the specified ODS column. ods-column can be a number, a numeric variable, or an expression that identifies the column to write to.

  • Requirement: If ods-column is a number, then it must be a positive integer.

    If ods-column is a numeric variable or an expression, then SAS treats it as follows :

    Variable or expression

    SAS response

    not an integer

    truncates the decimal portion and uses only the integer value

    0 or negative

    moves the pointer to column 1

  • Default: If ods-column exceeds the number of columns in the data component, then ODS

    1. writes the current line

    2. moves the pointer to the first ODS column on the next line

    3. continues to process the PUT statement.

  • Tip: You can alter the default behavior with options in the FILE PRINT ODS statement. For more information, see the discussion of overflow control on page 68.

  • Featured in: Example 4: Creating and Using a User-Defined Table Definition Template in SAS Output Delivery System: User s Guide

+ ods-column

  • moves the pointer by the specified number of ODS columns. ods-column can be a number, a numeric variable, or an expression that specifies the number of columns to move the pointer.

  • Requirement: If ods-column is a number, then it must be an integer.

    If ods-column is a numeric variable or an expression, then it does not have to be an integer. If it is not an integer, then SAS truncates the decimal portion and uses only the integer value.

    ods-column

    SAS response

    a positive integer

    moves the pointer to the right

    a negative integer

    moves the pointer to the left

    0

    pointer does not move

  • Tip: If the current column position becomes less than 1, then the pointer moves to column 1. If the current column position exceeds the number of columns in the data component, then ODS:

    1. writes the current line

    2. moves the pointer to the first ODS column on the next line

    3. continues to process the PUT statement.

@ column-name

  • moves the pointer to the ODS column identified by column-name . The column name is a data component variable name.

  • Requirement: column-name must be enclosed in quotation marks.

ODS Line Pointer Controls Line pointer controls in a DATA step that uses ODS are the same as line pointer controls in a DATA step that does not use ODS. However, you can use only those listed below with ODS. Line pointer controls have the following general forms:

#line

  • moves the pointer to the specified line. line can be a number, a numeric variable, or an expression that identifies the line that specifies where to write.

  • Requirement: If line is a number, then it must be an integer. If line is a numeric variable or an expression, it does not have to be an integer. If it is not an integer, then SAS truncates the decimal portion and uses only the integer value.

/

Note: If you use a line pointer control to skip lines in ODS output, then SAS sets to a missing value all columns that are not referenced on the current line or skipped lines to a missing value. Columns that contain numeric values will display a period for the missing value. If you prefer not to include these periods in your ODS output, you can display missing numeric values as a blank by using the MISSING statement or the MISSING= system option. For more information about this statement or option, see SAS Language Reference: Dictionary .

When the Pointer Moves Past the End of a Line In a DATA step that uses ODS, the number of columns in the buffer and in the data component are determined in one of three ways:

  • By default, the number of variables in the program data vector determines the number of ODS columns.

  • You can override the default by defining ODS columns with the COLUMNS= suboption in the FILE PRINT ODS statement.

  • If you associate a template with the data component, then the specifications in the template take precedence and might change the number of columns that actually appear in the output object.

When using pointer controls and the @ or @@, you might inadvertently position the pointer beyond the last ODS column. You can control how SAS handles this situation with options in the FILE PRINT ODS statement. For more information see the discussion of overflow control on page 68.

See Also

FILE Statement for ODS on page 68

Output Delivery System and the DATA Step in SAS Output Delivery System: User s Guide

Examples in SAS Output Delivery System: User s Guide

ODS _ALL_ CLOSE Statement

Closes all open ODS output destinations

Valid: anywhere

Category: ODS: Output Control

Syntax

ODS _ALL_ CLOSE ;

Details

The ODS _ALL_ CLOSE statement closes all open ODS output destinations.

Note: Be sure to open one or more ODS destinations before you execute your next program so that you can view or print your output within the same SAS session.

ODS CHTML Statement

Opens, manages , or closes the CHTML destination, which produces a compact, minimal HTML that does not use style information

Valid: anywhere

Category: ODS: Third-Party Formatted

Syntax

ODS CHTML <(<ID=> identifier )> < action >;

ODS CHTML <(<ID=> identifier )> < file-specification(s) >< option(s) >;

Options

The ODS CHTML statement is part of the MARKUP statement family. For a complete list of options, see the ODS MARKUP Statement on page 109.

Details

The ODS CHTML statement is part of the ODS markup family of statements. ODS statements in the markup family produce output that is formatted using one of many different markup languages such as HTML (Hypertext Markup Language), XML (Extensible Markup Language), and LaTeX. You can specify a markup language that SAS supplies , or create one of your own and store it as a user-defined markup language.

ODS CSVALL Statement

Opens, manages, or closes the CSVALL destination, which produces output containing columns of data values that are separated by commas, and produces tabular output with titles, notes, and bylines

Valid: anywhere

Category: ODS: Third-Party Formatted

Syntax

ODS CSVALL < (<ID=> identifier )> < action >;

ODS CSVALL <(<ID=> identifier )> < file-specification(s) >< option(s) >;

Options

For a complete list of options, see the ODS MARKUP Statement on page 109.

Details

The ODS CSVALL statement is part of the ODS markup family of statements. ODS statements in the markup family open the markup destination and produce output that is formatted using one of many different markup languages such as HTML (Hypertext Markup Language), XML (Extensible Markup Language), and LaTeX. You can specify a markup language that SAS supplies, or create one of your own and store it as a user-defined markup language.

ODS DECIMAL_ALIGN Statement

Controls the justification of numeric columns when no justification is specified

Valid: anywhere

Category: ODS: SAS Formatted

See: How Are Values in Table Columns Justified? on page 512

Interaction: The ODS DECIMAL_ALIGN statement only effects the RTF destination and the printer family of destinations.

Default: ODS NO_DECIMAL_ALIGN

Syntax

ODS DECIMAL_ALIGN | NO_DECIMAL_ALIGN ;

ODS DECIMAL_ALIGN

  • aligns values by the decimal point in numeric columns when no justification is specified.

  • Alias: ODS DECIMAL_ALIGN=YES

ODS NO_DECIMAL_ALIGN

  • right justifies numeric columns when no justification is specified.

  • Alias: ODS DECIMAL_ALIGN=NO

Details

The ODS DECIMAL_ALIGN statement has no effect on any column that is assigned a justification from a procedure or column definition.

ODS DOCBOOK Statement

Opens, manages, or closes the DOCBOOK destination, which produces XML output that conforms to the DocBook DTD by OASIS

Valid: anywhere

Category: ODS: Third-Party Formatted

Syntax

ODS DOCBOOK < (<ID=> identifier )> < action >;

ODS DOCBOOK <(<ID=> identifier )> < file-specification(s) >< option(s) >;

Options

For a complete list of options, see the ODS MARKUP Statement on page 109.

Details

The ODS DOCBOOK statement is part of the ODS markup family of statements. ODS statements in the markup family produce output that is formatted using one of many different markup languages such as HTML (Hypertext Markup Language), XML (Extensible Markup Language), and LaTeX. SAS supplies many markup languages for you to use ranging from DOCBOOK to TROFF. You can specify a markup language that SAS supplies, or create one of your own and store it as a user-defined markup language.

ODS DOCUMENT Statement

Opens, manages, or closes the DOCUMENT destination, which produces a hierarchy of output objects that enables you to produce multiple ODS output formats without rerunning a PROC or DATA step

Valid: anywhere

Category: ODS: Output Control

Syntax

ODS DOCUMENT action ;

ODS DOCUMENT < NAME= < libname. > memname

  • <( access “option )>>< DIR =(<PATH= path <( access-option )> <LABEL= label >>)>

  • < CATALOG = permanent-catalog | _NULL_>;

Actions

An action does one of the following:

  • closes the destination.

  • excludes output objects

  • selects output objects

  • writes the current exclusion list or selection list to the SAS log

An action can be any one of the following:

CLOSE

  • closes the destination and any files that are associated with it.

  • Tip: When an ODS destination is closed, ODS does not send output to that destination. Closing an unneeded destination frees some system resources.

EXCLUDE exclusion(s) | ALL | NONE

  • excludes one or more output objects from the DOCUMENT destination.

  • Default: NONE

  • Restriction: The DOCUMENT destination must be open for this action to take effect.

  • Main discussion: ODS EXCLUDE Statement on page 90

SELECT selection(s) | ALL | NONE

  • selects one or more output objects for the DOCUMENT destination.

  • Default: ALL

  • Restriction: The DOCUMENT destination must be open for this action to take effect.

  • Main discussion: ODS SELECT Statement on page 188

SHOW

  • writes the current selection or exclusion list for the destination to the SAS log.

  • Restriction: The destination must be open for this action to take effect.

  • Tip: If the selection or exclusion list is the default list (SELECT ALL), then SHOW also writes the entire selection or exclusion list.

  • See also: ODS SHOW Statement on page 197

Options

CATALOG = permanent-catalog | _NULL_

  • CAUTION:

    • If you do not specify a value (other than _NULL_) for this option, then you can replay temporary GRSEGs only during the session in which they are created, not in subsequent sessions.

  • permanent-catalog

    • copies any temporary GRSEG to the specified permanent catalog and keeps a reference to the permanent GRSEG in the document. This value persists until the ODS DOCUMENT statement is closed, or until you delete it by specifying CATALOG=_NULL_.

      The permanent catalog has the following form:

      • < libname. >< memname >;

  • _NULL_

    • deletes the catalog name that was previously specified for the CATALOG= option. Thereafter, temporary GRSEGs are not copied into the permanent catalog, and thus are unavailable in subsequent sessions.

  • Alias: CAT=

  • Default: By default, no value is assigned to CATALOG=, which means that temporary GRSEGs are not copied to a permanent catalog.

DIR=

(<PATH= path <( access-option )>> <LABEL= label >);

  • specifies the directory path and/or label for ODS output.

  • LABEL= label

    • assigns a label to a path.

    • Requirement: The label that you assign must be enclosed in quotation marks.

    • Interaction: If LABEL= is used with the PATH= option, then the label applies to the path. If LABEL= is used without the PATH= option, then the label applies to the entire document.

  • PATH=

  • path <( access-option )>

    • is specified as a sequence of entries that are delimited by backslashes.

    • path

      • can have the form:

        • path < #sequence “ number >

      • where

      • path

        • is the name of the path.

      • #sequence “number

        • is a number which, when combined with a path name, uniquely identifies the entry in the directory that contains it.

      • Default: The default path is \ (root).

      • Tip: You can specify a directory that contains entries that do not exist in the document.

    • access-option

      • specifies the access mode for the ODS document.

      • WRITE

        • opens a document and provides write access as well as read access.

        • Caution: If the ODS document already exists, then it will be overwritten.

        • Interaction: If a label has been specified with the LABEL= option, then it will override any existing label assigned to the document.

        • Tip: If the ODS document does not exist, then it will be created.

      • UPDATE

        • opens an ODS document and appends new content to the document. UPDATE provides update access as well as read access.

        • Caution: If the document already exists, then its contents will not be changed.

        • Interaction: If a label has been specified with the LABEL= option, then it will be assigned to the document.

        • Tip: If the ODS document does not exist, then the document will be created.

      • Default: UPDATE

    • Note: Procedure output or data queries will be added at the end of the directory.

NAME=

< libname. > memname <(access-option)>

  • libname

    • specifies the SAS library where the document is stored.

    • Default: If no library name is specified, the WORK library is used.

  • memname

    • specifies the document name.

    • Default: If no NAME= is specified, the specified options apply to the currently open document.

    • Default: If you do not specify an access-option with NAME=, then your directories will open in UPDATE mode.

  • access-option

    • specifies the access mode for the ODS document.

    • WRITE

      • opens a document and provides write access as well as read access.

      • Caution: If the ODS document already exists, then it will be overwritten.

      • Interaction: If a label has been specified with the LABEL= option, then it will override any existing label assigned to the document.

      • Tip: If the ODS document does not exist, then it will be created.

    • UPDATE

      • opens an ODS document and appends new content to the document. UPDATE provides update access as well as read access.

      • Caution: If the document already exists, then its contents will not be changed.

      • Interaction: If a label has been specified with the LABEL= option, then it will be assigned to the document.

      • Tip: If the ODS document does not exist, then the document will be created.

      • Default: UPDATE

    • Interaction: If you use the NAME= option in an ODS DOCUMENT statement without closing any instances of the DOCUMENT destination that are already open, the option will force ODS to close the destination and all files associated with it, and to open a new instance of the destination.

ODS EXCLUDE Statement

Specifies output objects to exclude from ODS destinations

Valid: anywhere

Category: ODS: Output Control

Syntax

ODS < ODS-destination > EXCLUDE exclusion(s) | ALL | NONE;

Arguments

exclusion(s)

  • specifies one or more output objects to add to an exclusion list.

    By default, ODS automatically modifies exclusion lists at the end of a DATA step that uses ODS, or at the end of a procedure step. For information about modifying these lists, see Selection and Exclusion Lists on page 34.

    For information ending a procedure or DATA step, see the section on DATA Step Processing in SAS Language Reference: Concepts .

    Each exclusion has the following form:

    • output-object <(PERSIST)>

  • output-object

    • specifies one or more output objects to exclude. To specify an output object, you need to know which output objects your SAS program produces. The ODS TRACE statement writes to the SAS log a trace record that includes the path, the label, and other information about each output object that is produced. You can specify

      • an output object as a full path. For example,

        Univariate.City_Pop_90.TestsForLocation 

        is the full path of the output object.

      • a partial path. A partial path consists of any part of the full path that begins immediately after a period (.) and continues to the end of the full path. For example, if the full path is

        Univariate.City_Pop_90.TestsForLocation 

        then the partial paths are:

        City_Pop_90.TestsForLocation  TestsForLocation 
      • a label that is enclosed by quotation marks. For example,

        "The UNIVARIATE Procedure" 
      • a label path. For example, the label path for the output object is

        "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location" 

        Note: The trace record shows the label path only if you specify the LABEL option in the ODS TRACE statement.

      • a partial label path. A partial label path consists of any part of the label that begins immediately after a period (.) and continues to the end of the label. For example, if the label path is

        "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location" 

        then the partial label paths are:

        "CityPop_90"."Tests For Location"  "Tests For Location" 
      • a mixture of labels and paths.

      • any of the partial path specifications, followed by a pound sign (#) and a number. For example, TestsForLocation#3 refers to the third output object that is named TestsForLocation.

    • See also: ODS TRACE Statement on page 197.

  • (PERSIST)

    • keeps the output-object that precedes the PERSIST option in the exclusion list, even if the DATA or procedure step ends, until you explicitly modify the list with

      • any ODS SELECT statement

      • ODS EXCLUDE NONE

      • ODS EXCLUDE ALL

      • an ODS EXCLUDE statement that applies to the same output object but does not specify PERSIST.

    • Requirement: You must enclose PERSIST in parentheses.

ALL

  • specifies that ODS does not send any output objects to the open destination.

  • Alias: ODS EXCLUDE DEFAULT

  • Interaction: If you specify ALL without specifying a destination, ODS sets the overall list to EXCLUDE ALL and sets all other lists to their defaults.

  • Tip: Using ODS EXCLUDE ALL is different from closing a destination. The destination remains open, but no output objects are sent to it.

  • Tip: To temporarily suspend a destination, use ODS SELECT NONE. Use ODS SELECT ALL when you want to resume sending output to the suspended destination.

NONE

  • specifies that ODS send all of the output objects to the open destination.

  • Interaction: If you specify the NONE argument without specifying a destination, ODS sets the overall list to EXCLUDE NONE and sets all other lists to their defaults.

  • Tip: ODS EXCLUDE NONE has the same effect as ODS SELECT ALL.

  • Tip: To temporarily suspend a destination, use ODS SELECT NONE. Use ODS SELECT ALL when you want to resume sending output to the suspended destination.

Options

ODS-destination

  • specifies which ODS destination s exclusion list to write to, where ODS-destination can be any valid ODS destination. For a discussion of ODS destinations, see What Are the ODS Destinations? on page 25.

  • Default: If you omit ODS-destination , ODS writes to the overall exclusion list.

  • Tip: To set the exclusion list for the Output destination to something other than the default, use the ODS OUTPUT Statement on page 135.

Details

Although you can maintain a selection list for one destination and an exclusion list for another, the results are less complicated if you maintain the same types of lists for all the destinations that you route output to.

See Also

Statements:

  • ODS SELECT Statement on page 188

  • ODS SHOW Statement on page 197

  • ODS TRACE Statement on page 197

ODS GRAPHICS Statement (Experimental)

Enables ODS automatic graphic capabilities

CAUTION:

  • The ODS GRAPHICS statement is an experimental feature that is available in SAS 9.1. Do not use the ODS GRAPHICS statement in production jobs.

Valid: anywhere

Category: ODS: Output Control

Default: OFF

Restriction: ODS statistical graphics do not create output for the LISTING destination. You must send your output to at least one other ODS destination (such as HTML, RTF, DOCUMENT, Printer family) to obtain output.

Restriction: ODS statistical graphics do not support any SAS/GRAPH global statements (such as GOPTIONS, SYMBOL, PATTERN).

Restriction: ODS statistical graphics do not support the GTITLE or GFOOTNOTE options available with the ODS destinations HTML, RTF, and MARKUP.

Restriction: ODS statistical graphics do not support the ODS USEGOPT statement.

See also: For more information about ODS statistical graphics and the procedures that produce them, see the section about statistical graphics using ODS in SAS/STAT User s Guide .

Syntax

ODS GRAPHICS < OFF | ON </ options >>;

Arguments

OFF

  • turns off the automatic ODS graphic generation.

ON

  • turns on the automatic ODS graphic generation.

Options

ANTIALIAS = OFF | ON

  • controls the smoothing of the components in a graph. All text displayed on the graph will always be anti-aliased.

    • OFF

      • does not smooth jagged edges of components other than text in the graph.

      • Alias: NOANTIALIAS

    • ON

      • smooths jagged edges of all components in the graph.

      • Alias: ANTIALIAS

  • Restriction: If the number of observations in the data set exceeds 250, then ANTIALIAS= is turned off, even if you specify the option ANTIALIAS=ON.

IMAGEFMT= image “file “type | STATIC | STATICMAP

  • specifies the image format to display graphics in ODS output. If the image format is not valid for the active output destination, the device is automatically remapped to the default image format.

    Note: This feature only effects the ODS statistical graphics features, and has no effect on standard graphics features that already rely on the GOPTIONS values.

    • image-file-type

      • specifies the type of image you want to add to your graph. For a list of image file types and their descriptions, see Supported Image File Types for Output Destinations on page 94.

    • STATIC

      • dynamically uses the best quality static image format for the active output destination.

    • STATICMAP

      • dynamically uses the best quality image map format for the active output destination, and provides a map file for tool tips.

      • Restriction: If the number of observations in the data set exceeds 500, then the map file is not generated.

  • Default: STATIC

IMAGENAME= filename

  • specifies the base image filename. By default, the name of the output object will be used. You can determine the name of the output object by using the ODS TRACE statement. For more information, see ODS TRACE Statement on page 197.

  • Restriction: The base image name should not contain extension information. ODS automatically adds the increment value and the appropriate extension (which is specific to the output destination that has been selected).

PERSIST | PERSIST=

  • determines when ODS clears the data cache that it is created when the ODS graphics feature is enabled.

    • PERSIST

      • clears the data cache on every RUN boundary.

    • PERSIST=PROC | RUN

      • maintains the data cache across either procedure boundaries or RUN boundaries.

        • PROC

          • maintains the data cache across procedure boundaries.

        • RUN

          • maintains the data cache across RUN boundaries.

          • Restriction: This value only yields different results when an interactive PROC is active; otherwise the DEFAULT/RUN settings are equivalent.

  • Default: PERSIST

RESET

  • Resets the index counter that is appended to static image files.

Details

Supported Image File Types for Output Destinations The following table lists all of the supported image file types for ODS output destinations.

Output Destination

Supported Image File Types

HTML

GIF (default), JPEG, PNG

LATEX

PS (default), EPSI, GIF, JPEG, PNG

Printer

Family Contained in PostScript file

RTF

Contained in RTF file

Description of Supported Image File Types

Image File Type

Description

EPSI (Microsoft NT Enhanced Metafile)

An extended version of the standard PostScript (PS) format. Files that use this format can be printed on PostScript printers and can also be imported into other applications. Notice that EPSI files can be read, but PS files cannot be read.

GIF (Graphics Interchange Format)

Supports only color -mapped images. GIF is owned by CompuServe, Inc.

JFIF (JPEG File Interchange Format)

Supports JPEG image compression. JFIF software is developed by the Independent JPEG Group .

PNG (Portable Network Graphic)

Supports true color, gray-scale , and 8-bit images.

PS (PostScript Image File Format)

The Image classes use only PostScript image operators. A level II PS printer is required for color images. PostScript was developed by Adobe Systems, Inc.

ODS HTML Statement

Opens, manages, or closes the HTML destination, which produces HTML 4.0 output that contains embedded stylesheets

Valid: anywhere

Category: ODS: Third-Party Formatted

CAUTION:

  • After SAS 9, the ODS HTML statement produces HTML 4.0 output that differs considerably from the HTML 3.2 output that is produced by previous versions of SAS. If you want HTML 3.2 formatting, use the ODS HTML3 statement or change the setting of the HTML version in the SAS registry. See Changing Your Default HTML Version Setting on page 32 for more information.

Restriction: When you open the destination, a stylesheet is written and linked to the body file. Therefore, you cannot make stylesheet changes from within your SAS program. For example, after the destination is open, changing the value of the STYLE= option has no effect. You can make style changes in either of the following ways::

  • Close the destination, edit or create a new stylesheet, then submit the program again specifying the new or modified stylesheet.

  • Edit the body file, changing the stylesheet url to the desired stylesheet.

Interaction: By default, when you execute a procedure that uses the FORMCHAR system option (for example, PROC PLOT or PROC CHART), ODS formats the output in SAS Monospace font. If you are creating output that will be viewed in an operating environment where SAS software is not installed, this output will not display correctly because without SAS, the SAS Monospace font is not recognized. To make your document display correctly, include the following statement before your SAS program:

OPTIONS FORMCHAR="|----|+|---+=|-/\<>*"; 
Syntax

ODS HTML <(<ID=> identifier )> < action >;

ODS HTML <(<ID=> identifier )> < html-file-specification(s) >< option(s) >;

Options

For a complete list of the options, see the ODS MARKUP Statement on page 109.

Details

The ODS HTML statement is part of the ODS markup family of statements. ODS statements in the markup family produce output that is formatted using one of many different markup languages such as HTML (Hypertext Markup Language), XML (Extensible Markup Language), and LaTeX. You can specify a markup language that SAS supplies, or create one of your own and store it as a user-defined markup language.

Examples
Example 1: Creating a Separate Body File for Each Page of Output

ODS features:

  • ODS HTML statement:

    • Action:

      • CLOSE

    • Arguments:

      • CONTENTS=

      • BODY=

      • FRAME=

      • PAGE=

    • Options:

      • BASE=

      • NEWFILE=

Other SAS features:

  • # BYVAL parameter in titles

  • NOBYLINE|BYLINE system option

  • OPTIONS statement

  • PROC FORMAT

  • PROC SORT

  • PROC REPORT

  • PROC TABULATE

  • TITLE statement

Program Description The following example creates a separate HTML file for each page of procedure output, as well as a table of contents, a table of pages, and a frame file. The table of contents and table of pages do not appear any different or behave any differently from those that would be created if all the output were in a single file. Because the output is in separate files, you cannot scroll from one page of output to the next. However, you can select individual HTML files to include in a report.

Note: This example uses filenames that might not be valid in all operating environments. To successfully run the example in your operating environment, you might need to change the file specifications. See Appendix 3, ODS HTML Statements for Running Examples in Different Operating Environments, on page 649.

Program

Create the input data set. The data set GRAIN_PRODUCTION contains data on the amounts of wheat, rice, and corn that the five leading grain-producing nations produced during 1995 and 1996.

data grain_production;     length Country $ 3 Type $ 5;     input Year country $ type $ Kilotons;     datalines;  1995 BRZ  Wheat    1516  1995 BRZ  Rice     11236  1995 BRZ  Corn     36276  1995 CHN  Wheat    102207  1995 CHN  Rice     185226  1995 CHN  Corn     112331  1995 IND  Wheat    63007  1995 IND  Rice     122372  1995 IND  Corn     9800  1995 INS  Wheat    .  1995 INS  Rice     49860  1995 INS  Corn     8223  1995 USA  Wheat    59494  1995 USA  Rice     7888  1995 USA  Corn     187300  1996 BRZ  Wheat    3302  1996 BRZ  Rice     10035  1996 BRZ  Corn     31975  1996 CHN  Wheat    109000  1996 CHN  Rice     190100  1996 CHN  Corn     119350  1996 IND  Wheat    62620  1996 IND  Rice     120012  1996 IND  Corn     8660  1996 INS  Wheat    .  1996 INS  Rice     51165  1996 INS  Corn     8925  1996 USA  Wheat    62099  1996 USA  Rice     7771  1996 USA  Corn     236064  ; 

Sort the data set. PROC SORT sorts the data, first by values of the variable Year , then by values of the variable Country , and finally by values of the variable Type .

proc sort data=grain_production;     by year country type;  run; 

Create a user-defined format. PROC FORMAT creates the user-defined format $CNTRY .

proc format;     value $cntry 'BRZ'='Brazil'                  'CHN'='China'                  'IND'='India'                  'INS'='Indonesia'                  'USA'='United States';  run; 

Close the LISTING destination so that no listing output is produced. The LISTING destination is open by default. The ODS LISTING statement closes the LISTING destination to conserve resources.

ods listing close; 

Create HTML output. The ODS HTML statement opens the HTML destination and creates HTML output.

The FRAME=, CONTENTS=, and PAGE= options create a frame that includes a table of contents and a table of pages that link to the contents of the body file. The body file also appears in the frame. BASE= specifies a string to use as the first part of all links and references to the HTML files. Because no URL is specified for individual files, the final part of the link will match the filename.

CAUTION:

  • The string that you specify must be a valid path to your HTML files.

ods html body='grain-body.htm'       contents='grain-contents.htm'          frame='grain-frame.htm'           page='grain-page.htm'           base='http://www.yourcompany.com/local-address/' 

Specify that SAS create a new body file for each page of output. The NEWFILE=PAGE option opens and creates a new body file for each page of output.

newfile=page; 

Suppress the default BY line and specify a new value into the BY line. The NOBYLINE option suppresses the default BY line variable. The #BYVAL parameter specification inserts the current value of the BY variable Year into the title.

options nobyline;  title 'Leading Grain-Producing Countries';  title2 'for #byval(year)'; 

Produce a report. This PROC REPORT step produces a report on grain production. Each BY group produces a page of output, so ODS creates a new body file for each BY group. The NOWINDOWS option specifies that PROC REPORT runs without the REPORT window and sends its output to the open output destination(s).

proc report data=grain_production nowindows;     by year;     column country type kilotons;     define country  / group width=14 format=$cntry.;     define type     / group 'Type of Grain';     define kilotons / format=comma12.;     footnote 'Measurements are in metric tons.';  run; 

Restore the default BY line and clear the second TITLE statement. The BYLINE option restores the default BY line. The TITLE2 statement clears the second TITLE statement.

options byline;  title2; 

Produce a report. The TABLE statement in this PROC TABULATE step has the variable Year as the page dimension. Therefore, PROC TABULATE explicitly produces one page of output for 1995 and one for 1996. ODS starts a new body file for each page.

proc tabulate data=grain_production format=comma12.;     class year country type;     var kilotons;     table year,           country*type,           kilotons*sum=' ' / box=_page_ misstext='No data';     format country $cntry.;     footnote 'Measurements are in metric tons.';  run; 

Close the HTML destination. The ODS HTML CLOSE statement closes the HTML destination and all the files that are associated with it. If you do not close the destination, then you will not be able to view the files in a browser window.

ods html close; 

HTML Output

This frame file shows the first body file. Links in the table of contents and the table of pages point to the other body files.

Click To expand
Display 5.3: HTML Frame File

Links That Are Created in the HTML Output These HREF= attributes from the links in the contents file point to the HTML tables that ODS creates from the PROC REPORT and PROC TABULATE steps.

HREF='http://www.yourcompany.com/local-address/grain-body.htm#IDX'  HREF='http://www.yourcompany.com/local-address/grain-body1.htm#IDX1'  HREF='http://www.yourcompany.com/local-address/grain-body2.htm#IDX2'  HREF='http://www.yourcompany.com/local-address/grain-body3.htm#IDX3' 

Notice how these HREF attributes are constructed :

  • The value of the BASE= option provides the first part of the HREF, which is http://www.yourcompany.com/local-address/. This part of the HREF is the same for all the links that ODS creates.

  • The value of the BODY= option, grain-body , provides the basis for the next part of the HREF. However, because the NEWFILE= option creates a new file for each output object, ODS increments this base value each time that it creates a file. The resulting file names become part of the HREF. They are grain-body.htm , grain-body1.htm , grain-body2.htm , and grain-body3.htm .

  • The value of the ANCHOR= option provides the basis for the last part of the HREF, which follows the pound sign (#). Because the ANCHOR= option is not used in this example, ODS uses the default value of IDX. With each use, ODS increments the value of the anchor.

Example 2: Appending to HTML Files

ODS features:

  • ODS HTML statement:

    • Argument:

      • BODY= with a fileref

        • NO_BOTTOM_MATTER suboption

        • NO_TOP_MATTER suboption

    • Options:

      • ANCHOR=

      • STYLE=

Other SAS features:

  • FILENAME statement

  • PROC PRINT

  • PROC REPORT

  • DATA _NULL_ statement

Data set:

  • GRAIN_PRODUCTION on page 97

Format:

  • $CNTRY. on page 98

Program Description The following example creates HTML output from PROC PRINT and PROC REPORT. It also uses the DATA step to write customized HTML code to the file that contains the HTML output. The DATA step executes between procedure steps.

Program

Close the LISTING destination so that no listing output is produced. The ODS LISTING statement closes the LISTING destination to conserve resources. If the destination is left open, then ODS will produce both Listing and HTML output.

ods listing close; 

Assign a fileref to the file GrainReport.html. The FILENAME statement assigns the fileref REPORTS to the file GrainReport.html that will contain the HTML output.

filename reports 'GrainReport.html'; 

Create HTML output and suppress the writing of the default HTML code that would be written at the end of the file. The ODS HTML statement opens the HTML destination and creates HTML output. The NO_BOTTOM_MATTER option suppresses the writing of the default HTML code that, by default, ODS writes at the end of a file.

ods html body=reports (no_bottom_matter) 

Specify the style definition for formatting the HTML output. The STYLE= option specifies that the style D3D be used.

style=D3D; 

Create a report that contains only the data from 1996. Select and format the variables that you want to include, specify a title, and specify a footnote. This PROC PRINT step prints the observations in the data set GRAIN_PRODUCTION that have a value of 1996 for the variable Year . The VAR statement selects country , type , and kilotons as the variables that you want to be displayed in the output. The TITLE and FOOTNOTE statements specify the title and footnote.

proc print data=grain_production;     var country type kilotons;     format country $cntry. kilotons comma12.;     where year=1996;     title 'Leading Grain-Producing Countries';     footnote 'Measurements are in metric tons.';  run; 

Close the HTML destination. The ODS HTML CLOSE statement closes the HTML destination and all the files that are associated with it.

ods html close; 

Assign the fileref REPORTS to the file GrainReport.html . This FILENAME statement assigns a fileref to the file to be updated, GrainReport.html . The MOD option opens the file in update mode.

Operating Environment Information: The MOD option might not be valid in all operating environments. See your operating environment documentation for more information.

filename reports 'GrainReport.html' mod; 

Append text to the HTML file REPORTS. This DATA step writes to the file that is referenced by REPORTS. The PUT statements create an H1 header in the HTML file.

data _null_;     file reports;     put ''<h1>The preceding output is from PROC PRINT.'';     put ''I am going to try a variety of procedures.'';     put ''Let me know which procedure you prefer.'';     put ''By the way, this report uses the D3D style.</h1>'';  run; 

Create HTML output. This ODS HTML statement opens the HTML destination and creates HTML output. The NO_TOP_MATTER and the NO_BOTTOM_MATTER suboptions suppress the default HTML code that ODS writes to the top and the bottom of a file.

ods html body=reports (no_top_matter no_bottom_matter) 

Specify the root name for the HTML anchor tags. The ANCHOR= option specifies report as the root name for the HTML anchor tags.

Note: When you use ODS to append to an HTML file that ODS created, you must specify a new anchor name each time that you open the file from ODS so that you do not write the same anchors to the file again. (ODS cannot recognize anchors that are already in the file when it opens it, and by default it uses IDX as the base for anchor names).

anchor='report'; 

Create a report that contains only the 1996 data. The PROC REPORT step prints the data set. ODS adds HTML output to the body file. The NOWINDOWS option specifies that PROC REPORT runs without the REPORT window and sends its output to the open output destination(s).

proc report data=grain_production nowindows;     where year=1996;     column country type kilotons;     define country / group width=14 format=$cntry.;     define type / group 'Type of Grain';     define kilotons / format=comma12.;  run; 

Close the HTML destination. The ODS HTML CLOSE statement closes the HTML destination and all the files that are associated with it.

ods html close; 

Append text to the HTML file REPORTS. This DATA step writes to the file that is referenced by REPORTS. The PUT statements create an H1 header in the HTML file.

data _null_;     file reports;     put ''<h1>The preceding output is from PROC REPORT.'';     put ''It doesnt repeat the name of the country on every line.'';     put ''This report uses the default style.</h1>'';  run; 

Create HTML output to write the bottom matter to the file, repress the printing of the top matter, and provide a new root name for the anchor tags. In order to write the bottom matter to the HTML file so that it contains valid HTML code, you must open the HTML destination one more time. NO_TOP_MATTER ensures that the top matter is not placed in the file again. ANCHOR= provides a new root name for the anchors in the bottom matter.

ods html body=reports(no_top_matter)anchor='end'; 

Close the HTML destination. The ODS HTML CLOSE statement closes the HTML destination and all the files that are open for that destination.

ods html close; 

HTML Output

This output is created by appending HTML output to an existing HTML file.

Click To expand
Display 5.4: HTML Output with Appended HTML
See Also

Statements:

  • Appendix 2, ODS and the HTML Destination, on page 637

  • ODS MARKUP Statement on page 109

ODS HTMLCSS Statement

Opens, manages, or closes the HTMLCSS destination, which produces HTML output with cascading style sheets

Valid: anywhere

Category: ODS: Third-Party Formatted

Syntax

ODS HTMLCSS < (<ID=> identifier )> < action >;

ODS HTMLCSS < (<ID=> identifier )> < file-specification(s) >< option(s) >;

Options

The ODS HTMLCSS statement is part of the MARKUP statement family. For a complete list of options, see the ODS MARKUP Statement on page 109.

Details

The ODS HTMLCSS statement is part of the ODS markup family of statements. ODS statements in the markup family produce output that is formatted using one of many different markup languages such as HTML (Hypertext Markup Language), XML (Extensible Markup Language), and LaTeX. You can specify a markup language that SAS supplies, or create one of your own and store it as a user-defined markup language.

ODS HTML3 Statement

Opens, manages, or closes the HTML3 destination, which produces HTML 3.2 formatted output

Valid: anywhere

Category: ODS: Third-Party Formatted

Syntax

ODS HTML3 <(<ID=> identifier )> < action >;

ODS HTML3 <(<ID=> identifier )> < html-file-specification(s) >< option(s) >;

Options

For a complete list of options, see the ODS MARKUP Statement on page 109.

Details

The ODS HTML3 statement is part of the ODS markup family of statements. ODS statements in the markup family produce output that is formatted using one of many different markup languages such as HTML (Hypertext Markup Language), XML (Extensible Markup Language), and LaTeX. You can specify a markup language that SAS supplies, or create one of your own and store it as a user-defined markup language.

By default, the SAS registry is configured to generate HTML 4 output when you specify the ODS HTML statement. To permanently change the default HTML version to 3.2, you can change the setting of the HTML version in the SAS registry. The ODS HTML statement will then produce HTML 3.2 output. For information about how to change your default HTML version, see Changing Your Default HTML Version Setting on page 32.

See Also

Statements:

  • ODS MARKUP Statement on page 109

  • ODS HTML Statement on page 95

Appendix 2, ODS and the HTML Destination, on page 637

Changing SAS Registry Settings for ODS on page 31

ODS IMODE Statement

Opens, manages, or closes the IMODE destination, which produces HTML output as a column of output, separated by lines

Valid: anywhere

Category: ODS: Third-Party Formatted

Syntax

ODS IMODE < (<ID=> identifier )> < action >;

ODS IMODE (<ID=> identifier )< file-specification(s) >< option(s) >;

Options

For a complete list of options, see the ODS MARKUP Statement on page 109.

Details

The ODS IMODE statement is part of the ODS markup family of statements. ODS statements in the markup family produce output that is formatted using one of many different markup languages such as HTML (Hypertext Markup Language), XML (Extensible Markup Language), and LaTeX . You can specify a markup language that SAS supplies, or create one of your own and store it as a user-defined markup language.

ODS LISTING Statement

Opens, manages, or closes the LISTING destination

Valid: anywhere

Category: ODS: SAS Formatted

Syntax

ODS LISTING < action >;

ODS LISTING <DATAPANEL= number | DATA | PAGE > <FILE= file-specification >;

Without an Action or Options

If you use the ODS LISTING statement without an action or options, it opens the LISTING destination.

Actions

An action does one of the following:

  • closes the destination

  • excludes output objects

  • selects output objects

  • writes the current exclusion list or selection list to the SAS log

An action can be one of the following:

CLOSE

  • closes the LISTING destination and any files that are associated with it.

  • Tip: When an ODS destination is closed, ODS does not send output to that destination. Closing an unneeded destination frees some system resources.

EXCLUDE exclusion(s) | ALL | NONE

  • excludes one or more output objects from the LISTING destination.

  • Default: NONE

  • Restriction: The LISTING destination must be open for this action to take effect.

  • Main discussion: ODS EXCLUDE Statement on page 90

SELECT selection(s) | ALL | NONE

  • selects output objects for the LISTING destination.

  • Default: ALL

  • Restriction: The LISTING destination must be open for this action to take effect.

  • Main discussion: ODS SELECT Statement on page 188

SHOW

  • writes the current selection or exclusion list for the LISTING destination to the SAS log.

  • Restriction: The LISTING destination must be open for this action to take effect.

  • Tip: If the selection or exclusion list is the default list (SELECT ALL), then SHOW also writes the entire selection or exclusion list.

  • See also: ODS SHOW Statement on page 197

Options

DATAPANEL= number |DATA|PAGE

  • suggests how to split a table that is too wide to fit on a single page into sections of columns and rows. Each section of columns and rows is a data panel . Each data panel has column headers at the top.

    Note: In this context, a page is what the procedure uses as a page in creating the Listing output. The SAS system options LINESIZE= and PAGESIZE= generally determine the page size , although some procedures (PROC REPORT, for example) can temporarily override the values that the system options specify.

  • number

    • writes the specified number of observations in a panel, if possible. More than one panel can occur on every page if space permits.

    • Range: 1 to the largest integer that the operating system supports

  • DATA

    • bases the size of the panel on the way the table is stored in memory. This value provides the fastest performance. However, if the table contains many columns, the number of rows in each panel might be small.

  • PAGE

    • tries to make panels that match the page size. If the table contains more columns than can fit on a page, the first page is filled with as many observations as possible for as many columns as will fit on a single line. The second page contains the same observations for the next group of columns, and so on until all rows and columns have been printed.

      This arrangement will minimize the amount of space used for column headers because most pages will contain observations for only one set of columns.

    • Restriction: If the page size is greater than 200, ODS uses DATAPANEL=200.

  • Default: PAGE

FILE= file-specification

  • specifies the file to write to. 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 about the FILENAME statement, see SAS Language Reference: Dictionary .)

  • Default: If you do not specify a file to write to, ODS writes the output to the LISTING window.

ODS MARKUP Statement

Opens, manages, or closes the MARKUP destination, which produces SAS output that is formatted using one of many different markup languages

Valid: anywhere

Category: ODS: Third-Party Formatted

Interaction: The output type is determined by the TAGSET | TYPE= option, which specifies the kind of markup language that is applied to the output.

Interaction: By default, when you execute a procedure that uses the FORMCHAR system option (for example, PROC PLOT or PROC CHART), ODS formats the output in SAS Monospace font. If you are creating output that will be viewed in an operating environment where SAS software is not installed, this output will not display correctly because without SAS, the SAS Monospace font is not recognized. To make your document display correctly, include the following statement before your SAS program:

OPTIONS FORMCHAR="|----|+|---+=|-/\<>*"; 
Syntax

ODS MARKUP <(<ID=> identifier )> < action >;

ODS MARKUP <(<ID=> identifier )> < markup-file-specification(s) >

  • < option(s) ><TAGSET= tagset-name >;

Actions

An action does one of the following:

  • closes the destination

  • excludes output objects

  • selects output objects

  • writes the current exclusion list or selection list to the SAS log

An action can be one of the following:

CLOSE

  • closes the destination and any files that are associated with it.

  • Tip: When an ODS destination is closed, ODS does not send output to that destination. Closing an unneeded destination conserves system resources.

EXCLUDE exclusion(s) | ALL | NONE

  • excludes one or more output objects from the destination.

  • Default: NONE

  • Restriction: A destination must be open for this action to take effect.

  • Main discussion: ODS EXCLUDE Statement on page 90

SELECT selection(s) | ALL | NONE

  • selects output objects for the specified destination.

  • Default: ALL

  • Restriction: A destination must be open for this action to take effect.

  • Main discussion: ODS SELECT Statement on page 188

SHOW

  • writes the current selection or exclusion list for the destination to the SAS log .

  • Restriction: A destination must be open for this action to take effect.

  • See also: ODS SHOW Statement on page 197

  • Tip: If the selection or exclusion list is the default list (SELECT ALL), then SHOW also writes the entire selection or exclusion list. For information about selection and exclusion lists, see Selection and Exclusion Lists on page 34.

Options

ANCHOR= anchor-name

  • specifies a unique base name for the anchor tag that identifies each output object in the current body file.

    Each output object has an anchor tag for the contents, page, and frame files 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.

    • anchor-name

      • is the base name for the anchor tag that identifies each output object in the current body file.

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

      • Requirement: You must enclose anchor-name in quotation marks.

      • Tip: You can change anchor names as often as you want by specifying the ANCHOR= option in a Markup Family statement anywhere in your program. Once you have specified an anchor name, it remains in effect until you specify a new one.

  • Restriction: Each anchor name in a file must be unique.

  • Interaction: If you open a file to append to it, then be sure to specify a new anchor name so that you do not write the same anchors to the file again. ODS does not recognize 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 markup language output. Because you can control where the anchor name changes, you know in advance what the anchor name will be at those points.

ARCHIVE= string

  • The ARCHIVE= option is only valid for the GOPTIONS java device. The ARCHIVE= option allows you to specify which applet to use in order to view the ODS HTM Loutput.

    The string must be one that the browser can interpret. For example, if the archive file is local to the machine that you are running SAS on, you can use the FILE protocol to identify the file. If you want to point to an archive file that is on a web server, use the HTTP protocol .

  • Default: If you do not specify ARCHIVE= and you are using the JAVA device driver, ODS uses the value of the SAS system option APPLETOC=. This value points to the location of the Java archive files that ship with the SAS system. To find out what the value of this option is, you can either look in the Options window in the Files folder under Environment Control, or you can submit the following procedure step:

    proc options option=appletloc;  run; 

    There is no default if you are using the ACTIVEX device driver.

  • Requirement: The ARCHIVE attribute is a feature of Java 1.1. Therefore, if you are using the Java device driver, your browser must support this version of Java. Both Internet Explorer 4.01 and Netscape 4.05 support Java 1.1.

  • Interaction: Use ARCHIVE= in conjunction with SAS/GRAPH procedures and the DEVICE=JAVA or DEVICE=ACTIVEX option in the GOPTIONS statement.

  • Tip: Typically, this option should not be used, because the SAS server automatically determines the correct SAS/Graph applets to view the ODS HTML output . However, if you have renamed the .jar files, or have other applets with which to view the ODS HTML output, this option allows you to access these applets.

  • Tip: As stated in the CODEBASE= documentation, it is recommend that you do not put a file path in your ARCHIVE option. Instead, use the CODEBASE option to specify the file path.

ATTRIBUTES= ( attribute-pair-1 ... attribute-pair-n )

  • writes the specified attributes between the tags that generate dynamic graphics output.

    • attribute-pair

      • specifies the name and value of each attribute. attribute-pair has the following form:

        • attribute-name = attribute-value

        • attribute-name

          • is the name of the attribute.

        • attribute-value

          • is the value of the attribute.

      • Requirement: You must enclose attribute-name and attribute-value in quotation marks.

  • Interaction: Use the ATTRIBUTES= option in conjunction with SAS/GRAPH procedures and with the DEVICE=JAVA, JAVAMETA, or ACTIVEX options in the GOPTIONS statement.

  • See also: SAS/GRAPH Reference, Volumes 1 and 2 for valid attributes for the following applets:

    • Graph Applet

    • Map Applet

    • Contour Applet

    • MetaView Applet

BASE= base-text

  • Specifies the text to use as the first part of all links and references that ODS creates in the output files.

    • base-text

      • is the text that ODS uses as the first part of all links and references that ODS creates in the file.

      • 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.

    • Requirement: You must enclose base-text in quotation marks.

CHARSET= character-set

  • specifies the character set to be generated in the META declaration for the HTML output.

  • See: For information about the CHARSET option, see SAS National Language Support (NLS): User s Guide .

CODEBASE= string

  • creates a file path that is used by the GOPTIONS devices. The CODEBASE file path option has two definitions, depending on the GOPTIONS device used.

    • For the Java device:

      • The CODEBASE file path points to the directory that contains the java applets (.jar files). If a CODEBASE file path is not specified, the SAS server generates a default CODEBASE file path that is based on the install location for the applets. The install location for the applets is recorded in the SAS option APPLETLOC and can be modified by a user. It is important to note that if the default path created by the SAS install is used, the HTML output file must be viewed on the machine from which the output was generated. A typical use of CODEBASE would be to specify an HTTP:// reference to the installed applets so that the output can be viewed from any machine on the Web.

      • Interaction: If you only specify CODEBASE, the SAS server will automatically generate the correct ARCHIVE= for the HTML output. This feature allows you to put the applets in one location on the web and easily generate output that points to that location. This is regardless of the type of java graphs that are generated on the ODS HTML output page. The ARCHIVE= option can be set with or without a file path. It is recommended that you do not put paths in your ARCHIVE= option. If you set an ARCHIVE= that contains a file path, that path is used in the place of any CODEBASE specification. Instead, use the CODEBASE option to specify the file path. If you specify both CODEBASE= and ARCHIVE= options, they will be used as you specified them.

    • For the ActiveX device:

      • If a CODEBASE= file path (including a required filename) is specified for an ActiveX control, then the browser will attempt to install the control from the location (including the filename) specified in the CODEBASE= file path. This happens if the control is not already installed on the user s machine. By default, the SAS server does not generate a CODEBASE= file path for the ActiveX control. A typical use for this functionality is for a user to put the install setup for the control on the web. All web users can then generate their HTML output with a CODEBASE that points to this location. If another user (who does not have the control installed) tries to view the output, then the user will be prompted to install the control on their machine.

ENCODING= local-character-set-encoding

  • overrides the encoding for input or output processing (transcodes) of external files.

  • See: For information about the ENCODING= option, see SAS National Language Support (NLS): User s Guide .

GFOOTNOTE | NOGFOOTNOTE

  • controls the location where footnotes are printed in the graphics output.

    • GFOOTNOTE

      • prints footnotes that are created by SAS/GRAPH, which appear inside the graph borders.

    • NOGFOOTNOTE

      • prints footnotes that are created by ODS, which will appear outside the graph borders.

  • Default: GFOOTNOTE

  • Restriction: Footnotes that are displayed by a markup language statement support all SAS/GRAPH FOOTNOTE statement options. The font must be valid for the browser. Options that ODS cannot handle, such as text angle specifications, are ignored. For details about the SAS/GRAPH FOOTNOTE statement, see SAS/GRAPH Reference, Volumes 1 and 2 .

  • Restriction: This option applies only to SAS programs that produce SAS/GRAPH output files.

GPATH= file-specification <(url= Uniform-Resource-Locator | NONE)>

  • specifies the location for all graphics output that is generated while the destination is open.

    • file-specification

      • specifies the file or SAS catalog to write to. 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 about how ODS names catalog entries and external files, see SAS/GRAPH Reference, Volumes 1 and 2 . file-specification can be one of the following:

        • external-file

          • is the name of an external file to write to.

          • Requirement: You must enclose external-file in quotation marks.

        • fileref

          • is a fileref that has been assigned to an external file. Use the FILENAME statement to assign a fileref. For information about the FILENAME statement, see SAS Language Reference: Dictionary .

          • Interaction: If you specify a fileref in the GPATH= option, then ODS does not use information from the GPATH= option when it constructs links.

        • libref . catalog

          • specifies a SAS catalog to write to.

    • URL= Uniform-Resource-Locator | NONE

      • provides a URL for file-specification .

        • Uniform-Resource-Locator

          • is the URL you specify. ODS uses this URL instead of the file name in all the links and references that it creates to the file.

          • Requirement: You must enclose Uniform-Resource-Locator in quotation marks.

        • NONE

          • specifies that no information from the GPATH= option appears in the links or references.

    • Tip: This option is useful for building output 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), then they will resolve, as long as the contents, page, and body files are all in the same location.

  • Default: If you omit the GPATH= option, then ODS stores graphics in the location that is specified by the PATH= option. If you do not specify the PATH= option, then ODS stores the graphics in the current directory. For more information, see the PATH= option on page 119.

GTITLE | NOGTITLE

  • controls the location where titles are printed in the graphics output.

    • GTITLE

      • prints the title that is created by SAS/GRAPH, which will appear inside the graph borders

    • NOGTITLE

      • prints the title that is created by ODS, which will appear outside the graph borders.

  • Default: GTITLE

  • Restriction: Titles that are displayed by any markup language statement support most SAS/GRAPH TITLE statement options. The font must be valid for the browser. Options that ODS cannot handle, such as text angle specifications, are ignored. For details about the SAS/GRAPH TITLE statement, see SAS/GRAPH Reference, Volumes 1 and 2 .

  • Restriction: This option applies only to SAS programs that produce one or more SAS/GRAPH output files.

HEADTEXT= markup-document-head

  • specifies markup tags to place between the <HEAD> and </HEAD> tags in all the files that the destination writes to.

    • markup-document-head

      • is the markup tags to place between the <HEAD> and </HEAD> tags.

  • Tip: ODS cannot parse the markup that you supply. It should be well- formed markup that is correct in the context of the <HEAD> and </HEAD> tags.

  • Tip: Use the HEADTEXT= option to define programs (such as JavaScript) that you can use later in the file.

(ID= identifier )

  • enables you to run multiple instances of the same destination at the same time. Each instance can have different options.

    • identifier

      • specifies another instance of the destination that is already open. identifier can be numeric or a series of characters that begin with a letter or an underscore . Subsequent characters can include letters , underscores, and numeric characters.

  • Restriction: If identifier is numeric, it must be a positive integer.

  • Requirement: The ID= option must be specified immediately after the ODS MARKUP/TAGSET statement keywords.

  • Tip: You can omit the ID= option, and instead use a name or a number to identify the instance.

  • Featured in: Example 1 on page 155

  • markup-file-specification

    • opens a markup family destination and specifies the markup file(s) to write to. These files remain open until you do one of the following:

      • close the destination with either an ODS Markup-family-destination CLOSE statement or ODS _ALL_ CLOSE statement.

      • open the same destination with a second markup family statement. This closes the first file and opens the second file.

      • markup-file-specification has the following form:

      • file-type = file-specification <( file-specification-suboption(s) )>

      • file-type =

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

          • BODY=

            • specifies the file that contains the primary output that is created by the ODS statement.

              Note: For some values of TAGSET=, this output will be an HTML file, for other TAGSET= values, the output will be an XML file, and so on.

            • Alias: FILE=

            • Interaction: If you use the BODY= option in an ODS markup family statement that refers to an open ODS markup destination, the option will force ODS to close the destination and all files associated with it, and then to open a new instance of the destination. For more information see Opening and Closing the MARKUP Destination on page 125.

            • Featured in: All examples

          • CODE=

            • specifies the file that contains relevant style information, such as XSL (Extensible Stylesheet Language).

          • CONTENTS=

            • specifies the file that contains a table of contents for the output.

          • FRAME=

            • for HTML output, specifies the file that integrates the table of contents, the page contents, and the body file. If you open the frame file, then you see a table of contents, a table of pages, or both, as well as the body file.

              For XLM output, FRAME= specifies the file that contains the DTD.

            • Restriction: If you specify the FRAME= argument, then you must also specify CONTENTS=, PAGE=, or both.

          • PAGE=

            • specifies the file that contains a description of each page of the body file, and contains links to the body file. ODS produces a new page of output whenever a procedure requests a new page.

            • Interaction: The SAS system option PAGESIZE= has no effect on pages in HTML output except when you are creating batch output. For information on the PAGESIZE= option see SAS Language Reference: Dictionary .

          • STYLESHEET=

            • places the style information for markup output into an external file, or reads stylesheet information from an existing file.

              Note: By default, if you do not specifically send the information to a separate file, then the stylesheet information is included in the specified HTML file.

      • file-specification

        • specifies the file, fileref, or SAS catalog to write to.

          • file-specification can be one of the following:

          • external-file

            • is the name of an external file to write to.

            • Requirement: You must enclose external-file in quotation marks.

          • fileref

            • is a fileref that has been assigned to an external file. Use the FILENAME statement to assign a fileref.

            • See: For information about the FILENAME statement, see SAS Language Reference: Dictionary .

          • entry . markup

            • 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 the PATH= argument.

      • ( file-specification-suboption(s) )

        • provide instructions for writing the output files.

          • file-specification-suboptions can be one of the following:

          • NO_BOTTOM_MATTER

            • specifies that no ending markup language source code be added to the output file or.

            • Alias: NOBOT

            • Requirement: If you append text to an external file you must use a FILENAME statement with the appropriate option for the operating environment.

            • Interaction: The NO_BOTTOM_MATTER suboption, in conjunction with the NO_TOP_MATTER suboption, makes it possible for you to add output to an existing file and then to put your own markup language between output objects in the file.

            • Interaction: When you are opening a file that ODS has previously written to, you must use the ANCHOR= option to specify a new base name for the anchors in order to avoid duplicate anchors.

            • Tip: If you want to leave a body file in a state that you can append to with ODS, then use NO_BOTTOM_MATTER with the file-specification in the BODY= option in any markup language statement.

            • See also: NO_TOP_MATTER on page 116

          • NO_TOP_MATTER

            • specifies that no beginning markup language source code be added to the top of the output file. For HTML 4.0, the NO_TOP_MATTER option removes the stylesheet.

            • Alias: NOTOP

            • Requirement: If you append text to an external file you must use a FILENAME statement with the appropriate option for the operating environment.

            • Interaction: The NO_TOP_MATTER suboption, in conjunction with the NO_BOTTOM_MATTER suboption, makes it possible for you to add output to an existing file and then to put your own markup language between output objects in the file.

            • Interaction: When you are opening a file that ODS has previously written to, you must use the ANCHOR= option to specify a new base name for the anchors in order to avoid duplicate anchors.

            • See also: NO_BOTTOM_MATTER on page 116 and ANCHOR= on page 110

          • URL= Uniform-Resource-Locator

            • provides a URL for the file-specification . ODS uses this URL (instead of the file name) in all the links and references that it creates and that point to the file.

            • Tip: This option is useful for building HTML files that can be moved from one location to another. The links from the contents and page files must be constructed with a single name URL, and the contents, page, and body files must all be in the same location.

            • Tip: You never need to specify this suboption with the FRAME= option because ODS files do not reference the frame file.

          • DYNAMIC

            • enables you to send output directly to a web server instead of writing it to a file. This option sets the value of the HTMLCONTENTTYPE= attribute. For more information see the HTMLCONTENTTYPE= attribute on page 311.

            • Default: If you do not specify DYNAMIC, then ODS sets the value of HTMLCONTENTTYPE= for writing to a file.

            • Restriction: If you specify the DYNAMIC suboption with any file-type= file-specification in the ODS HTML statement, then you must specify it for all the file-type= file-specification in the statement.

        • Restriction: You must specify file-specification-suboption(s) inside parentheses, next to the file-specification in the BODY=, CONTENTS=, PAGE=, or FRAME= option.

METATEXT= metatext-for-document-head

  • specifies HTML code to use as the <META> tag between the <HEAD> and </ HEAD> tags of all the HTML files that the destination writes to.

    • metatext-for-document-head

      • specifies the HTML code that provides the browser with information about the document that it is loading. For example, this attribute could specify the content type and the character set to use.

  • Default: If you do not specify METATEXT=, then 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 code that you supply. It should be well-formed HTML code that is correct in the context of the <HEAD> tags. If you are using METATEXT= as it is intended, then your META tag should look like this:

    <META your-metatext-is-here> 
  • Restriction: METATEXT= cannot exceed 256 characters.

NEWFILE= starting-point

  • creates a new body file at the specified starting-point .

    • starting-point

      • is the location in the output where you want to create a new body file.

        ODS automatically names new files by incrementing the name of the body file. In the following example, ODS names the first body file REPORT.XML . Additional body files are named REPORT1.XML , REPORT2.XML , and so on.

        Example:

        BODY= 'REPORT.XML' 
      • starting-point can be one of the following:

      • BYGROUP

        • starts a new file for the results of each BY group.

      • 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 SAS/GRAPH output 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

  • Tip: If you end the file name with a number, then ODS begins incrementing with that number. In the following example, ODS names the first body file MAY5.XML . Additional body files are named MAY6.XML , MAY7.XML , and so on.

    • Example:

      BODY= 'MAY5.XML' 

NOGFOOTNOTE

  • See: GFOOTNOTE | NOGFOOTNOTE options

NOGTITLE

  • See: GTITLE | NOGTITLE options

PARAMETERS= ( parameter-pair-1 ... parameter-pair-n )

  • writes the specified parameters between the tags that generate dynamic graphics output.

    • parameter-pair

      • specifies the name and value of each parameter. parameter-pair has the following form:

        • parameter-name = parameter-value

        • parameter-name

          • is the name of the parameter.

        • parameter-value

          • is the value of the parameter.

      • Requirement: You must enclose parameter-name and parameter-value in quotation marks.

  • Interaction: Use PARAMETERS= in conjunction with SAS/GRAPH procedures and the DEVICE=JAVA, JAVAMETA, or ACTIVEX options in the GOPTIONS statement.

  • See also: SAS/GRAPH Reference, Volumes 1 and 2 for valid parameters for the following applets:

    • Graph Applet

    • Map Applet

    • Contour Applet

    • MetaView Applet

PATH= file-specification (URL= Uniform-Resource-Locator | NONE)

  • specifies the location of an external file or a SAS catalog for all markup files.

    • file-specification

      • specifies the file or SAS catalog to write to.

        • file-specification can be one of the following:

        • external-file

          • is the name of an external file to write to.

          • Requirement: You must enclose external-file in quotation marks.

        • fileref

          • is a fileref that has been assigned to an external file. Use the FILENAME statement to assign a fileref.

          • Interaction: If you use a fileref in the PATH= option, then ODS does not use information from PATH= when it constructs links.

          • See: For information about the FILENAME statement, see SAS Language Reference: Dictionary .

    • URL= Uniform-Resource-Locator | NONE

      • provides a URL for the file-specification .

        • Uniform-Resource-Locator

          • is the URL you specify. ODS uses this URL instead of the file name in all the links and references that it creates to the file.

        • NONE

          • specifies that no information from the PATH= option appears in the links or references.

      • Tip: This option is useful for building output files that can be moved from one location to another. The links from the contents and page files must be constructed with a single-name URL, and the contents, page, and body files must be in the same location.

RECORD_SEPARATOR= alternative-separator | NONE

  • specifies an alternative character or string that separates lines in the output files.

    Different operating environments use different separator characters. If you do not specify a record separator, then the files are formatted for the environment where you run the SAS job. However, if you are generating files for viewing in a different operating environment that uses a different separator character, then you can specify a record separator that is appropriate for the target environment.

    • alternative-separator

      • represents one or more characters in hexadecimal or ASCII format. For example, the following option specifies a record separator for a carriage return character and a linefeed character for use with an ASCII file system:

        RECORD_SEPARATOR= '0D0A'x 
      • Requirement: You must enclose alternative-separator in quotation marks.

    • NONE

      • produces the markup language that is appropriate for the environment where you run the SAS job.

      • Operating Environment Information: In a mainframe environment, by default, ODS produces a binary file that contains embedded record separator characters. This binary file is not restricted by the line-length restrictions on ASCII files. However, if you view the binary files in a text editor, then the lines run together.

        If you want to format the files so that you can read them with a text editor, then use RECORD_SEPARATOR= NONE. In this case, ODS writes one line of markup language 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 the logical record length of the file is not long enough, then the markup language might wrap to another line at an inappropriate place.

  • Alias:

    • RECSEP=

    • RS=

STYLE= style-definition

  • specifies the style definition to use in writing the output files.

    • style-definition

      • describes how to display the presentation aspects (color, font face, font size, and so on) of your SAS output. A style definition determines the overall appearance of the documents that use it. Each style definition is composed of style elements.

      • Main discussion: For a complete discussion of style definitions, see Chapter 9, TEMPLATE Procedure: Creating a Style Definition, on page 285.

      • See also: For information about creating your own style definitions, see Chapter 9, TEMPLATE Procedure: Creating a Style Definition, on page 285.

      • Interaction: The STYLE= option is not valid when you are creating XML output.

  • Default: If you do not specify a style definition, then ODS uses the file that is specified in the SAS registry subkey

    • ODS DESTINATIONS MARKUP Selected Style

    • By default, this value specifies styles.default .

  • Interaction: If you specify the STYLE= option on an ODS HTML4 statement and wish to change the style definition with another ODS HTML4 statement , you must close the first statement before specifying the second statement, in order for any PROC PRINT output to use the second style definition.

TAGSET= tagset-name

  • specifies a keyword value for a tagset. A tagset is a template that defines how to create a markup language output type from a SAS format. Tagsets produce markup output such as Hypertext Markup Language (HTML), Extensible Markup Language (XML), and LaTeX.

    • An alternate form for specifying a tagset is as follows:

      • ODS directory . tagset-name file-specification(s) < option(s) >;

      • ODS directory . tagset-name action ;

    • A directory can be TAGSETS, a user defined entry, or a libref. By default, the tagsets that SAS supplies are located in the directory TAGSETS, which is within the item store SASUSER.TMPLMST. For more information about user defined tagsets and item stores, see Chapter 7, TEMPLATE Procedure: Overview, on page 261.

  • Alias: TYPE=

  • Default: If you do not specify a TAGSET= value, then the ODS MARKUP statement defaults to XML output.

  • Interaction: If you use the TAGSET= option in an ODS markup family statement that refers to an open ODS markup destination, then the option will force ODS to close the destination and all files associated with it, and then to open a new instance of the destination. For more information, see Opening and Closing the MARKUP Destination on page 125.

  • Tip: SAS provides a set of tagset definitions. To get a list of the tagset names that SAS supplies, plus any tagsets that you created and stored in the SASUSER.TMPLMST template store, submit the following SAS statements:

    proc template;     list tagsets;  run; 
  • See also: For additional information about specifying tagsets, see Chapter 11, TEMPLATE Procedure: Creating Markup Language Tagsets, on page 551. The values for TAGSET= can be one of the following, which are the tagsets (templates) supplied by SAS:

    • CHTML

      • produces compact, minimal HTML output that does not use style information. It does produce a hierarchical table of contents.

      • See: ODS CHTML Statement on page 84

    • COLORLATEX

      • produces color LaTeX, which is a document preparation system for high quality typesetting. It also generates a stylesheet. The output can be generated as PDF.

      • CAUTION:

        • COLORLATEX is an experimental tagset. Do not use this tagset in production jobs.

    • CSV

      • produces tabular output that contains columns of data values that are separated by commas.

      • CAUTION:

        • CSV is an experimental tagset. Do not use this tagset in production jobs.

      • Featured in: Creating Different Data Delimiters in a TagsetExample 8 on page 605

    • CSVALL

      • produces tabular output with titles that contain columns of data values that are separated by commas.

      • See also: ODS CSVALL Statement on page 85

    • CSVBYLINE

      • produces output with comma-separated values and columns of data that are separated by commas.

      • CAUTION:

        • CSVBYLINE is an experimental tagset. Do not use this tagset in production jobs.

    • XML

      • produces XML output.

    • DOCBOOK

      • produces XML output that conforms to the DocBook DTD by OASIS.

      • See also: ODS DOCBOOK Statement on page 86

    • EVENT_MAP

      • creates XML output that shows which events are being triggered and which variables are used by an event to send output from a SAS process to an output file. When you run a SAS process with EVENT_MAP, ODS writes XML to an output file that shows all event names and variable names as tags. The output helps you to create your own tagsets.

    • GRAPH

      • produces markup for graphical output that is produced by SAS/GRAPH.

    • HTML4

      • produces HTML 4.0 embedded stylesheets.

      • See also: ODS HTML Statement on page 95

    • HTMLCSS

      • produces HTML output with cascading stylesheets that is similar to ODS HTML output.

      • See also: ODS HTMLCSS Statement on page 105

    • IMODE

      • produces HTML output as a column of output that is separated by lines. This tagset is used by the Japanese telephone service provider, NTT.

      • See also: ODS IMODE Statement on page 106

    • LATEX

      • produces LaTeX, which is a document preparation system for high-quality typesetting. It also generates a stylesheet. The output can be generated as PDF.

      • CAUTION:

        • LATEX is an experimental tagset. Do not use this tagset in production jobs.

    • MSOFFICE_HTML

      • produces HTML code for output generated by ODS for Microsoft Office products.

    • MVSHTML

      • produces URLs within HTML files that are used in the OS/390 operating environment.

      • CAUTION:

        • MVSHTML is an experimental tagset. Do not use this tagset in production jobs.

    • NAMEDHTML

      • creates HTML output similar to STYLE_POPUP on page 124, but with all the objects labeled as they are when using ODS TRACE.

      • CAUTION:

        • NAMEDHTML is an experimental tagset. Do not use this tagset in production jobs.

    • ODSSTYLE

      • creates PROC TEMPLATE code for the STYLESHEET= option. The output helps you to create and modify style definitions.

      • CAUTION:

        • ODSSTYLE is an experimental tagset. Do not use this tagset in production jobs.

    • ODSXRPCS

      • produces an ODS XML remote program command stream.

      • CAUTION:

        • ODSXRPCS is an experimental tagset. Do not use this tagset in production jobs.

    • PHTML

      • produces simple HTML output that uses twelve style elements and no class attributes.

      • See also: ODS PHTML Statement on page 159

    • PYX

      • produces PYX, which is a simple, line-oriented notation used by Pyxie to describe the information communicated by an XML parser to an XML application. Pyxie is an Open Source library for processing XML with the Python programming language.

      • CAUTION:

        • PYX is an experimental tagset. Do not use this tagset in production jobs.

    • SASFMT

      • produces format markup tags that you create for the XML engine.

    • SASXMISS

      • produces alternate missing-value markup tags for the XML engine.

    • SASXMNSP

      • produces alternate no space in text value markup for the XML engine.

    • SASXMOG

      • produce generic XML code that is similar to the Oracle8iXML implementation used by ORACLE.

        Note: This is the tagset used by the SAS XML LIBNAME engine for the XMLTYPE= GENERIC option.

    • SASXMOH

      • produces very simple HTML output.

        Note: This is the tagset used by the SAS XML LIBNAME engine for XMLTYPE= HTML.

    • SASXMOIM

      • produces XML code that is supported by the Open Information Model (Database Schema Model) proposed by the Metadata Coalition (MDC) as vendor- and technology-independent, conforming to the XML 1.0 specification.

        Note: This is the tagset used by the SAS XML LIBNAME engine for the XMLTYPE= OIMDBM option.

    • SASXMOR

      • produces XML that is equivalent to the Oracle8iXML implementation, which is used by ORACLE.

        Note: This is the tagset used by the SAS XML LIBNAME engine for XMLTYPE= ORACLE.

    • SHORT_MAP

      • creates a subset of the XML output that is created by the EVENT_MAP tagset.

      • CAUTION:

        • SHORT_MAP is an experimental tagset. Do not use this tagset in production jobs.

    • STATGRAPH

      • produces markup for statistical graphs that are generated by SAS procedures.

    • STYLE_DISPLAY

      • creates a sample page of HTML output that is similar to STYLE_POPUP output. The output helps you to create and modify styles.

      • CAUTION:

        • STYLE_DISPLAY is an experimental tagset. Do not use this tagset in production jobs.

      • See also: STYLE_POPUP on page 124

    • STYLE_POPUP

      • creates HTML like HTMLCSS, but if you re using Internet Explorer, STYLE_POPUP displays a window that shows the resolved ODS style definition for any item that you select.

      • CAUTION:

        • STYLE_POPUP is an experimental tagset. Do not use this tagset in production jobs.

    • TEXT_MAP

      • creates text output that shows which events are being triggered as ODS handles the output objects.

      • CAUTION:

        • TEXT_MAP is an experimental tagset. Do not use this tagset in production jobs.

      • Tip: You can use the TEXT_MAP output as an alternative to the output that is created by the EVENT_MAP tagset.

      • See also: EVENT_MAP on page 122

    • TPL_STYLE_LIST

      • creates HTML output in a bulleted list similar to EVENT_MAP but lists only a subset of the possible attributes.

      • CAUTION:

        • TPL_STYLE_LIST is an experimental tagset. Do not use this tagset in production jobs.

      • Tip: The output helps you to understand tagsets and styles.

    • TPL_STYLE_MAP

      • creates XML output similar to EVENT_MAP but lists only a subset of the possible attributes.

      • CAUTION:

        • TPL_STYLE_MAP is an experimental tagset. Do not use this tagset in production jobs.

      • Tip: The output helps you to understand tagsets and styles.

    • TROFF

      • produces Troff code, which is a text-formatting language used for high-quality photo typesetters and laser printers.

      • CAUTION:

        • TROFF is an experimental tagset. Do not use this tagset in production jobs.

    • user-defined-tagset

      • specifies the tagset that you created using PROC TEMPLATE.

      • Main discussion: Creating Your Own Tagsets on page 585

    • WML

      • uses the Wireless Application Protocol (WAP) to produce a Wireless Markup Language (WML) DTD with a list of URLs as a table of contents.

      • See also: ODS WML Statement on page 206

    • WMLOLIST

      • uses the Wireless Application Protocol (WAP) to produce a Wireless Markup Language (WML) DTD with an option list for the table of contents. For more information, see Wireless Application Protocol.

      • CAUTION:

        • WMLOLIST is an experimental tagset. Do not use this tagset in production jobs.

  • Default: XML

TRANTAB= translation-table

  • specifies the translation table to use when transcoding a file for output.

  • See: For information about the TRANTAB= option, see SAS National Language Support (NLS): User s Guide .

Details

Opening and Closing the MARKUP Destination You can modify an open MARKUP destination with many ODS MARKUP options. However, the BODY= and TAGSET= options will automatically close the open destination that is referred to in the ODS MARKUP statement, and will also close any files associated with it, and then will open a new instance of the destination. If you use one of these options, it is best if you explicitly close the destination yourself.

Specifying Multiple ODS Destinations The ODS MARKUP statement opens or closes one destination. Like all single output destinations, you can have only one markup destination open at one time, unless you use the ID= option.

However, you can specify multiple simultaneous ODS destinations to produce multiple markup output by doing both of the following::

  • specifying some of the TAGSET= value keywords as a destination

  • specifying any two-level tagset name, such as TAGSETS.PYX, TAGSETS.STYLE_DISPLAY, or one of your own tagset names.

Specifying a Tagset Keyword as an ODS Destination

You can specify some tagset keywords as ODS destinations. The tagset determines the type of markup that you will have in your output file. For example, either of the following sets of statements are acceptable:

ods markup body='class.html' tagset=phtml;  ...more SAS statements...  ods markup close;  ods phtml body='class.html';  ...more SAS statements...  ods phtml close; 

The ODS statement that you use to close a destination must be in the same form as the ODS statement that you used to open the destination. Therefore, the following is not acceptable, because SAS considers MARKUP and PHTML as separate destinations.

ods markup body='class.html' tagset=phtml;  ...more SAS statements...  ods phtml close; 

The tagsets that you can specify as both a TAGSET= value for ODS MARKUP or as a separate ODS destination are as follows:

  • CHTML

  • CSV

  • CSVALL

  • DOCBOOK

  • HTML4

  • HTMLCSS

  • IMODE

  • LATEX

  • PHTML

  • SASREPORT

  • TROFF

  • WML

  • WMLOLIST

Specifying a Two-Level Tagset Name as an ODS Destination

You can open a destination by specifying the markup that you want to produce by naming its two-level tagset name. You can specify all tagsets in this manner. For example, the following ODS statements open the SASIOXML and MYTAGSET destinations. The ODS _ALL_ CLOSE statement closes the SASIOXML and MYTAGSET destinations as well as all other open destinations.

ods tagsets.sasioxml body='test1.xml';  ods tagsets.mytagset body='test2.xml';  ...more SAS statements...  ods _all_ close; 

You can also specify tagset names as follows, using the TYPE= option with a two-level tagset name:

ods markup type=tagsets.sasioxml body='test.xml'; 
Examples
Example 1: Creating an XML FILE
  • ODS features:

    • ODS LISTING statement:

      • Action:

        • CLOSE

    • ODS MARKUP statement:

      • Action:

        • CLOSE

      • Arguments:

        • BODY=

  • Other SAS features:

    • PROC PRINT

  • Data Set:

    • Creating the Statepop Data Set on page 620

Program Description The following is an ODS MARKUP example that creates XML markup from PRINT procedure output. The TAGSET= option for the ODS MARKUP statement is not specified, which defaults to XML output.

Program

Close the LISTING destination so that no listing output is produced. The LISTING destination is open by default. The ODS LISTING statement closes the LISTING destination to conserve resources.

ods listing close; 

Create XML output. The ODS MARKUP BODY= statement creates an XML file.

ods markup body='population.xml'; 

Print the data set. The PRINT procedure prints the data set state.pop .

proc print data=statepop;  run; 

Close the MARKUP destination. The ODS MARKUP CLOSE statement closes the MARKUP destination and all the files that are associated with it. If you do not close the destination, then you will not be able to view the files.

ods markup close; 

XML Output The following partial output is tagged with XML (Extensible Markup Language) tags.

Output 5.1: XML Markup from PRINT Procedure Output
Start example
<?xml version="1.0" encoding="windows-1252"?>  <odsxml>  <head>  <meta operator="user"/>  </head>  <body>  <proc name="Univariate">  <label name="IDX"/>  <title class="SystemTitle" toc-level="1">US Census of Population and Housing</title>  <proc-title class="ProcTitle" toc-level="1">The UNIVARIATE Procedure</proc-title>  <proc-title class="ProcTitle" toc-level="1">Variable:  CityPop_90  (1990 metropolitan pop in millions)</proc-title>  <branch name="Univariate" label="The Univariate Procedure" class="ContentProcName" toc-level="1">  <branch name="CityPop_90" label="CityPop_90" class="ContentFolder" toc-level="2">  <leaf name="Moments" label="Moments" class="ContentItem" toc-level="3">  <output name="Moments" label="Moments" clabel="Moments">  <output-object type="table" class="Table">    <style>      <border spacing="1" padding="7" rules="groups" frame="box"/>    </style>  <colspecs columns="4">  <colgroup>  <colspec name="1" width="15" type="string"/>  <colspec name="2" width="10" align="right" type="string"/>  <colspec name="3" width="16" type="string"/>  <colspec name="4" width="10" align="right" type="string"/>  </colgroup>  </colspecs>  <output-head>  <row>  <header type="string" class="Header" row="1" column="1" column-end="4">    <style>      <span columns="4"/>    </style>  <value>Moments</value>  </header>  </row>  </output-head>  <output-body>  ... more tagged output ...  <data raw-value="P8jU/fO2RaI=" name="Low" type="double" class="Data" row="8" column="1">  <value>0.194</value>  </data>  <data raw-value="QEIAAAAAAAA=" name="LowObs" type="double" class="Data" row="8" column="2">  <value>36</value>  </data>  <data raw-value="QDboMSbpeNU=" name="High" type="double" class="Data" row="8" column="3">  <value>22.907</value>  </data>  <data raw-value="QEiAAAAAAAA=" name="HighObs" type="double" class="Data" row="8" column="4">  <value>49</value>  </data>  </row>  </output-body>  </output-object>  </output>  </leaf>  </branch>  </branch>  <footnote class="SystemFooter" toc-level="1">^{super *}This is a  ^S={foreground=black}footnote.</footnote>  </proc>  </body>  </odsxml> 
End example
 
Example 2: Creating an XML File and a DTD
  • ODS features:

    • ODS LISTING statement:

      • Action:

        • CLOSE

    • ODS MARKUP statement:

      • Action:

        • CLOSE

      • Arguments:

        • BODY=

        • FRAME=

        • TAGSET=

  • Other SAS features:

    • PROC UNIVARIATE

  • Data Set:

    • Creating the Statepop Data Set on page 620

Program Description The following ODS MARKUP example creates an XML file and its Document Type Definition (DTD) related information document from PROC UNIVARIATE output.

Program

Close the LISTING destination so that no listing output is produced. The LISTING destination is open by default. The ODS LISTING statement closes the LISTING destination to conserve resources.

ods listing close; 

Create XML output and a DTD. The ODS MARKUP BODY= statement creates an XML file. The FRAME= option specifies that you want the DTD in a frame file, and the TAGSET= option specifies that you want the default tagset, which is XML.

ods markup body='statepop.xml'             frame='statepop.dtd' tagset=default; 

Generate the statistical tables for the analysis variables. The PROC UNIVARIATE statement calculates univariate statistics for numeric variables in the STATEPOP data set. The VAR statement specifies the analysis variables and their order in the output. The TITLE statement specifies a title for the output object.

proc univariate data=statepop;     var citypop_90 citypop_80;  title 'US Census of Population and Housing';  run; 

Close the MARKUP destination. The ODS MARKUP CLOSE statement closes the MARKUP destination and all the files that are associated with it. If you do not close the destination, then you will not be able to view the files.

ods markup close; 

Output This DTD specifies how the markup tags in a group of SGML or XML documents should be interpreted by an application that displays, prints, or otherwise processes the documents.

Output 5.2: DTD Created by the ODS MARKUP Statement
Start example
<!ELEMENT odsxml (head?,body)>  <!ELEMENT head (meta|css)*>  <!ELEMENT body ((label|page)*|proc)+>  <!ELEMENT meta EMPTY>  <!ATTLIST meta            operator  CDATA  #IMPLIED            author    CDATA  #IMPLIED>  <!ELEMENT css EMPTY>  <!ATTLIST css            file  CDATA  #IMPLIED>  <!ELEMENT label EMPTY>  <!ATTLIST label            name      ID    #IMPLIED>  <!ELEMENT proc (title|proc-title|note|page|label|style|branch|output)*>  <!ATTLIST proc            class    CDATA    #IMPLIED>  ... more tagged output ...  <!ELEMENT br EMPTY>  <!ELEMENT page EMPTY>  <!ELEMENT b (#PCDATA|it|b|ul)*>  <!ELEMENT ul (#PCDATA|it|b|ul)*>  <!ELEMENT it (#PCDATA|it|b|ul)*>  <!ELEMENT style (span|align|border)*>  <!ELEMENT span EMPTY>  <!ATTLIST span            columns    CDATA    #IMPLIED            rows       CDATA    #IMPLIED>  <!ELEMENT align EMPTY>  <!ATTLIST align            horiz  (left|center|right|justify)    "left">  <!ELEMENT border EMPTY>  <!ATTLIST border            rules    (none|groups|rows|cols|all)    #IMPLIED            frame    (void|above|below|hsides|lhs|rhs|vsides|box|border) #IMPLIED            padding  CDATA                          #IMPLIED            spacing  CDATA                          #IMPLIED> 
End example
 
Example 3: Creating Multiple Markup Output
  • ODS features:

    • ODS LISTING statement:

      • Action:

        • CLOSE

    • ODS CSVALL statement:

      • Arguments:

        • BODY=

    • ODS MARKUP statement:

      • Arguments:

        • BODY=

        • TAGSET=

  • Other SAS features:

    • OPTIONS statement

    • PROC PRINT

    • TITLE statement

  • Data set:

    • GRAIN_PRODUCTION on page 97

  • Format:

    • $CNTRY on page 98

Program Description The following ODS example creates two different types of markup output from the same procedure output. To create two markup outputs requires two ODS destinations. Because ODS MARKUP is considered one destination, you cannot specify two tagsets without the use of the ID= option. However, you can specify one output using ODS MARKUP, then specify the other output using ODS syntax in which you specify the tagset as the destination.

Program

Close the LISTING destination so that no listing output is produced. The LISTING destination is open by default. The ODS LISTING statement closes the LISTING destination to conserve resources. The OPTIONS statement specifies that only fifteen observations be used.

ods listing close;  options obs=15; 

Create tabular output. The ODS CSVALL statement produces tabular output with titles that contain columns of data values that are separated by commas

ods csvall body='procprintcsvall.csv'; 

Create CHTML output. The ODS MARKUP TAGSET=CHTML statement produces compact, minimal HTML output that does not use style information, and a hierarchical table of contents.

ods markup tagset=chtml body='procprintchtml.html'; 

Print the data set. The PRINT procedure prints the data set grain_production . The TITLE statement specifies the title.

title 'Leading Grain-Producing Countries';  proc print data=grain_production;  run; 

Close the open destinations so that you can viewor print the output. The ODS CSVALL CLOSE statement closes the CSVALL destination and all of the files that are associated with it. The ODS MARKUP TAGSET=CHTML L CLOSE statement closes the MARKUP destination and all of the files that are associated with it. You must close the destinations before you can view the output with a browser or before you can send the output to a physical printer.

ods csvall close;  ods markup tagset=chtml close; 

Output

The following output was created by specifying the MARKUP TAGSET=CHTML statement.

Click To expand
Display 5.5: CHTML Output

The following output was created by specifying the ODS CSVALL statement.

Note: Note that you cannot specify ODS MARKUP TAGSET=CSVALL and ODS MARKUP TAGSET=CHTML together, or ODS CSVALL and ODS CHTML together.

Click To expand
Display 5.6: CSVALL Output Viewed in Microsoft Excel
Example 4: Specifying Tagset Names as ODS Destinations

When you specify tagsets and two-level tagset names as destinations, you can open and close multiple destinations, producing multiple markup output. For example:

ods htmlcss body='test1.html';  ods phtml body='test2.html';  ods chtml body='test3.html';  ods markup body='test1.xml';  ods tagsets.event_map  body='test2.xml';  ...more SAS statements...  ods htmlcss close;  ...more SAS statements...  ods chtml close;  ...more SAS statements...  ods _all_ close; 

ODS OUTPUT Statement

Produces a SAS data set from an output object and manages the selection and exclusion lists for the OUTPUT destination

Valid: anywhere

Category: ODS: SAS Formatted

Syntax

ODS OUTPUT action ;

ODS OUTPUT data-set-definition(s) ;

Actions

An action can be one of the following:

CLEAR

  • sets the list for the OUTPUT destination to EXCLUDE ALL.

CLOSE

  • closes the OUTPUT destination. When an ODS destination is closed, ODS does not send output to that destination. Closing a destination frees some system resources.

SHOW

  • writes to the SAS log the current selection or exclusion list for the OUTPUT destination. If the list is the default list (EXCLUDE ALL), then SHOW also writes the current overall selection or exclusion list.

Arguments

data-set-definition

  • provides instructions for turning an output object into a SAS data set. ODS maintains a list of these definitions. This list is the selection list for the OUTPUT destination. For information about how ODS manages this list, see Selection and Exclusion Lists on page 34. Each data-set-definition has the following form:

    • output-object-specification <= SAS-data-set >

  • where

  • output-object-specification

    • has the following form:

      • output-object <(MATCH_ALL<= macro-var-name > PERSIST=PROC | RUN)>

    • output-object

      • identifies one or more output objects to turn into a SAS data set.

        To specify an output object, you need to know which output objects your SAS program produces. The ODS TRACE statement writes to the SAS log a trace record that includes the path, the label, and other information about each output object that is produced. For more information, about the ODS TRACE statement see SAS Output Delivery System: User s Guide . You can specify an output object as any of the following:

        • a full path. For example,

          Univariate.City_Pop_90.TestsForLocation 

          is the full path of the output object.

        • a partial path. A partial path consists of any part of the full path that begins immediately after a period (.) and continues to the end of the full path. For example, if the full path is

          Univariate.City_Pop_90.TestsForLocation 

          then the partial paths are:

          City_Pop_90.TestsForLocation  TestsForLocation 
        • a label that is enclosed in quotation marks.

          For example,

          "Tests For Location" 
        • a label path. For example, the label path for the output object is

          "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location"

          Note: The trace record shows the label path only if you specify the LABEL option in the ODS TRACE statement.

        • a partial label path. A partial label path consists of any part of the label that begins immediately after a period (.) and continues to the end of the label. For example, if the label path is

          "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location" 

          then the partial label paths are:

          "CityPop_90"."Tests For Location"  "Tests For Location" 
        • a mixture of labels and paths.

        • any of the partial path specifications, followed by a pound sign (#) and a number. For example, TestsForLocation#3 refers to the third output object that is named TestsForLocation.

      • Tip: To create multiple data sets from the same output object, list the output object as many times as you want. Each time that you list the output object, specify a different data set.

    • MATCH_ALL=< macro-var-name >

      • creates a new data set for each output object. For an explanation of how ODS names these data sets, see the discussion of SAS-data-set on page 137.

      • macro-var-name

        • specifies the macro variable where a list of all the data sets that are created are stored. Thus, if you want to concatenate all the data sets after the PROC step, then you can use the macro variable to specify all the data sets in a DATA step.

      • Tip: The MATCH_ALL option is not needed to merge conflicting output objects into one data set.

        • CAUTION:

          • A data set that is produced by SAS 9.1 without MATCH_ALL will not necessarily be identical to a data set produced by SAS 9.0 with MATCH_ALL and then concatenated in a data step. With SAS 9.0, merging dissimilar output objects with the MATCH_ALL option could result in missing columns or truncated variables. With SAS 9.1, these restrictions do not apply. For more information about merging output objects, see Merging Dissimilar Output Objects into One Data Set on page 137 .

  • PERSIST=PROC | RUN

    • determines when ODS closes any data sets that it is creating, and determines when ODS removes output objects from the selection list for the OUTPUT destination.

    • PROC

      • maintains the list of definitions even after the procedure ends, until you explicitly modify it. To modify the list, use ODS OUTPUT with one or more data-set-specifications . To set the list for the OUTPUT destination to EXCLUDE ALL, use the following statement:

        ods output clear; 
    • RUN

      • maintains the list of definitions and keeps open the data sets that it is creating even if the procedure or DATA step ends, or until you explicitly modify the list.

    • See also: How Does ODS Determine the Destinations for an Output Object? on page 35

  • SAS-data-set

    • names the output data set. You can use a one-level or two-level (with a libref) name.

      If you are creating a single data set, then the ODS OUTPUT statement simply uses the name that you specify. If you are creating multiple data sets with MATCH_ALL, then the ODS OUTPUT statement appends numbers to the name. For example, if you specify test as SAS-data-set and you create three data sets, then ODS names the first data set test . The additional data sets are named test1 and test2 .

    • Note: If you end the file name with a number, then ODS begins incrementing the name of the file with that number. For example, if you specify may5 as SAS-data-set and you create three data sets, then ODS names the first data set may5 . The additional data sets are named may6 and may7 .

    • Default: If you do not specify a data set, then ODS names the output data set DATA n , where n is the smallest integer that makes the name unique.

    • Tip: You can specify data set options in parentheses immediately after SAS-data-set .

SHOW

  • functions just like the ODS SHOW statement except that it writes only the selection or exclusion list for the OUTPUT destination.

Details

Merging Dissimilar Output Objects into One Data Set By default, the ODS OUTPUT statement puts all output objects that have the same output-path into one SAS data set, regardless of any conflictions between variables in the output objects. Variables created by a later output object will get a value of missing in the observations created by the earlier output object. Variables created by an earlier output object that do not exist in a subsequent output object will get a value of missing in the observations added by the later output object. If a variable created by an output object has a different type than a variable with the same name created by an earlier output object, it will be added to the output data set using a new name formed by adding a numeric suffix.

Examples
Example 1: Creating a Combined Output Data Set

ODS features:

  • ODS _ALL_ CLOSE statement

  • ODS HTML statement:

    • BODY=

    • CONTENTS=

    • FRAME=

    • PAGE=

  • ODS LISTING statement:

    • CLOSE

  • ODS OUTPUT statement

Other SAS features:

  • PROC FORMAT

  • PROC PRINT

  • PROC TABULATE

  • KEEP= data set option

Program Description This example routes two output objects that PROC TABULATE produces to both the OUTPUT destination and the HTML destination. The result is two output objects that are combined by the ODS OUTPUT statement to create an output data set formatted as HTML output by the ODS HTML statement.

Note: This example uses filenames that might not be valid in all operating environments. To successfully run the example in your operating environment, you might need to change the file specifications. See Appendix 3, ODS HTML Statements for Running Examples in Different Operating Environments, on page 649.

Program

Create the input data set. The data set ENERGY contains data on expenditures of energy for business and residential customers in individual states in the Northeast and West regions of the United States.

data energy;     length State ;     input Region Division state $ Type Expenditures @@;     datalines;  1 1 ME 1 708  1 1 ME 2 379  1 1 NH 1 597   1 1 NH 2 301  1 1 VT 1 353  1 1 VT 2 188  1 1 MA 1 3264  1 1 MA 2 2498  1 1 RI 1 531  1 1 RI 2 358  1 1 CT 1 2024  1 1 CT 2 1405  1 2 NY 1 8786 1 2 NY 2 7825 1 2 NJ 1 4115  1 2 NJ 2 3558  1 2 PA 1 6478 1 2 PA 2 3695 4 3 MT 1 322   4 3 MT 2 232  4 3 ID 1 392  4 3 ID 2 298  4 3 WY 1 194   4 3 WY 2 184  4 3 CO 1 1215 4 3 CO 2 1173 4 3 NM 1 545   4 3 NM 2 578  4 3 AZ 1 1694 4 3 AZ 2 1448 4 3 UT 1 621   4 3 UT 2 438  4 3 NV 1 493  4 3 NV 2 378  4 4 WA 1 1680  4 4 WA 2 1122  4 4 OR 1 1014 4 4 OR 2 756  4 4 CA 1 10643 4 4 CA 2 10114  4 4 AK 1 349  4 4 AK 2 329  4 4 HI 1 273   4 4 HI 2 298  ; 

Format the variables Region, Division, and Type. PROC FORMAT creates formats for Region , Division , and Type .

proc format;     value regfmt 1='Northeast'                  2='South'                  3='Midwest'                  4='West';     value divfmt 1='New England'                  2='Middle Atlantic'                  3='Mountain'                  4='Pacific';     value usetype 1='Residential Customers'                   2='Business Customers';  run; 

Do not produce listing output. The ODS LISTING statement closes the LISTING destination to conserve resources. (Otherwise, output would be written to the LISTING destination by default.)

ods listing close; 

Create the SAS output data set. The ODS OUTPUT statement creates the SAS data set energyoutput from the output objects that PROC TABULATE produces. The name of each output object is Table . You can determine the name of the output objects by using the ODS TRACE ON statement. For information about the ODS TRACE statement, see ODS TRACE Statement on page 197.

Specify the variables that you want to be written to the output SAS data set. The KEEP= data set option limits the variables in the output data set energyoutput to Region , Division , Type , and Expenditures_sum . The variable name Expenditures_sum is generated by PROC TABULATE to indicate that the sum statistic was generated for the Expenditures variable.

ods output Table=energyoutput(keep=region division type expenditures_sum); 

Create HTML output. The ODS HTML statement opens the HTML destination and creates HTML output. The output from PROC TABULATE is sent to the body file. FRAME=, CONTENTS=, and PAGE= create a frame that includes a table of contents and a table of pages that link to the contents of the body file. The body file also appears in the frame.

ods html body='your_body_file.html'          frame='your_frame_file.html'  contents='your_contents_file.html'        page='your_page_file.html'; 

Create output data sets and an HTML report. This PROC TABULATE step creates two output objects named Table , one for each BY group, and adds them to the energyoutput data set. Because the HTML destination is open, ODS writes the output to the body file.

proc tabulate data=energy format=dollar12.;     by region;     class division type;     var expenditures;     table division,           type*expenditures;     format region regfmt. division divfmt. type usetype.;     title 'Energy Expenditures for Each Region';     title2 '(millions of dollars)';  run; 

Close the current body file and open a new file. The ODS HTML BODY= statement closes the original body file and opens a new one. The contents, page, and frame files remain open. The contents and page files will contain links to both body files.

Create HTML output. The ODS HTML statement opens the HTML destination and creates HTML output. The output from PROC TABULATE is sent to the body file. FRAME=, CONTENTS=, and PAGE= create a frame that includes a table of contents and a table of pages that link to the contents of the body file. The body file also appears in the frame.

ods html body='your_body_file_2.html'; 

Print the combined data set. This PROC PRINT step prints the data set energyoutput that contains both BY groups. The output is added to the current body file, your_body_file_2.html .

proc print data=energyoutput noobs;     title 'Combined Output Data Set';  run; 

Close all of the open destinations. The ODS _ALL_ CLOSE statement closes all open ODS output destinations. To return ODS to its default setup, the ODS LISTING statement opens the LISTING destination.

ods _all_ close;  ods listing; 

HTML Output

The following HTML output shows the output DATA set that is created by the ODS OUTPUT statement.

Click To expand
Display 5.7: Combined Data Set

The following output shows the two separate BY groups that are created by the TABULATE procedure.

Click To expand
Display 5.8: Output Objects Created by PROC TABULATE
Example 2: Using Different Procedures to Create a Data Set from Similar Output Objects

ODS features:

  • ODS HTML statement:

    • BODY=

    • CONTENTS=

    • FRAME=

  • ODS OUTPUT statement

  • ODS SELECT statement

Other SAS features:

  • PROC GLM

  • PROC PRINT

  • PROC REG

Data set: IRON on page 191

Program Description This example creates and prints a data set that is created from the parameter estimates that PROC REG and PROC GLM generate. These procedures are part of SAS/STAT software.

Note: This example uses file names that may not be valid in all operating environments. To successfully run the example in your operating environment, you may need to change the file specifications. See Appendix 3, ODS HTML Statements for Running Examples in Different Operating Environments, on page 649.

Program

Set the SAS system options for the LISTING output. The NODATE option suppresses the display of the date and time in the LISTING output. PAGENO= specifies the starting page number. PAGESIZE= specifies the number of lines on an output page. LINESIZE= specifies the output line length.

options nodate pageno=1 pagesize=60 linesize=72; 

Create HTML output. The ODS HTML statement opens the HTML destination and creates HTML output. The FRAME= and CONTENTS= options create a frame that includes a table of contents that links to the contents of the body file. The body file also appears in the frame.

ods html body='parameter-estimates-body.htm'          frame='parameter-estimates-frame.htm'       contents='parameter-estimates-contents.htm'; 

Specify the output objects to be sent to all open ODS destinations. The ODS SELECT statement specifies that output objects named ParameterEstimates should be sent to all open ODS destinations that do not specifically exclude them. The LISTING destination is open by default, and its default list is SELECT ALL. The ODS HTML statement has opened the HTML destination, and its default list is also SELECT ALL. Thus any object that is named ParameterEstimates will go to both these destinations. The PERSIST option specifies that ParameterEstimates should remain in the overall selection list until the list is explicitly modified.

ods select ParameterEstimates(persist); 

Create the IronParameterEstimates data set . The ODS OUTPUT statement opens the OUTPUT destination and creates the SAS data set IronParameterEstimates . By default, the list for the OUTPUT destination is EXCLUDE ALL. This ODS OUTPUT statement puts ParameterEstimates in the selection list for the destination. The PERSIST=PROC option specifies that ParameterEstimates should remain in the overall selection list until the procedure ends or the list is explicitly modified.

ods output ParameterEstimates=IronParameterEstimates (persist=proc); 

Create the output objects. PROC REG and PROC GLM each produce an output object named ParameterEstimates. Because the data set definition persists when the procedure ends, ODS creates a output object from each one.

proc reg data=iron;     model loss=fe;  title 'Parameter Estimate from PROC REG';  run;  quit;  proc glm data=iron;     model loss=fe;  title 'Parameter Estimate from PROC GLM';  run;  quit; 

Allow all open destinations to receive output objects. The ODS SELECT ALL statement sets the lists for all destinations to their defaults so that ODS sends all output objects to the HTML and LISTING destinations. (Without this statement, none of the output objects from the following PROC PRINT steps would be sent to the open destinations.)

ods select all; 

Print the reports. The PROC PRINT steps print the data set that ODS created from PROC REG and PROC GLM. The output from these steps goes to both the HTML and the LISTING destinations. Links to the HTML output are added to the contents file.

proc print data=IronParameterEstimates noobs;  title 'PROC PRINT Report of the Data set from PROC REG';  run; 

Close the OUTPUT and HTML destinations. The ODS _ALL_ CLOSE statement closes all open destinations except for the LISTING destination, which is open by default.

ods _all_ close; 

HTML Output

The HTML output includes the parameter estimates from PROC REG, the parameter estimates from PROC GLM, and a report of the data set that ODS created from each set of parameter estimates.

The table of contents identifies output objects by their labels. The label for ParameterEstimates in PROC REG is Parameter Estimates. The corresponding label in PROC GLM is Solution. Notice how the column widths in the HTML output are automatically adjusted to fit the data. Compare this layout to the layout of the columns in the listing output.

Click To expand
Display 5.9: HTML Output from the REG, GLM, and PRINT Procedures

Listing Output

Output 5.3: Listing Output from the REG, GLM, and PRINT Procedures
Start example
                  Parameter Estimate from PROC REG                  1                           The REG Procedure                             Model: MODEL1                       Dependent Variable: Loss                          Parameter Estimates                       Parameter       Standard  Variable     DF       Estimate          Error   t Value    Pr > |t|  Intercept     1      129.78660        1.40274     92.52      <.0001  Fe            1      24.01989        1.27977    18.77      <.0001                         Parameter Estimate from PROC GLM                        2                                The GLM Procedure  Dependent Variable: Loss                                          Standard     Parameter         Estimate              Error      t Value     Pr > |t|     Intercept      129.7865993         1.40273671        92.52       <.0001     Fe             24.0198934         1.27976715       18.77       <.0001         PROC PRINT Report of the Data Set Created from PROC GLM and PROC REG 3  Model   Dependent Variable  DF    Estimate      StdErr  tValue  Probt  MODEL1     Loss   Intercept  1   129.78660     1.40274   92.52 <.0001  MODEL1     Loss   Fe         1   24.01989     1.27977  18.77 <.0001 
End example
 
Example 3: Creating a Data Set With and Without The MATCH_ALL Option

ODS features:

  • ODS HTML statement:

    • BODY=

  • ODS LISTING

  • ODS OUTPUT statement:

    • MATCH_ALL

  • ODS TRACE statement

Other SAS features:

  • PROC PRINT

  • PROC REG

Data set:

  • Creating the Model Data Set on page 621

Program Description This example illustrates the differences in the data sets created by specifying the MATCH_ALL option and by not specifying the MATCH_ALL option. The first program creates a merged data set by specifying the MATCH_ALL option. The second program creates a merged data set without specifying the MATCH_ALL option.

The data sets that are printed are parameter estimates that PROC REG generates. The PROC REG procedure is part of SAS/STAT software.

Note: This example uses file names that may not be valid in all operating environments. To successfully run the example in your operating environment, you may need to change the file specifications. See Appendix 3, ODS HTML Statements for Running Examples in Different Operating Environments, on page 649.

Program 1

Do not create LISTING output. The ODS LISTING statement closes the LISTING destination to conserve resources. Otherwise, output would be written to the LISTING destination by default.

ods listing close; 

Prepare a SAS data set to be created. The ODS OUTPUT statement opens the OUTPUT destination. By default, the list for the OUTPUT destination is EXCLUDE ALL. This ODS OUTPUT statement puts SelectionSummary in the selection list for the destination.

The MATCH_ALL option produces a SAS data set for each instance of SelectionSummary . The name of the first data set is summary , and the name of the second data set is summary1 . ODS stores a list of these names in the macro variable list . This variable is used later in the example to combine the data sets.

ods output SelectionSummary(match_all=list) = summary;  title1 'Using the MATCH_ALL Option Produces Two Data Sets With Different Columns'; 

Create the output objects and view a record of them in the log. PROC REG creates the output objects.

The ODS TRACE statement writes to the SAS log a record of each output object that is created. The ODS TRACE OFF statement represses the printing of the records.

ods trace on;  proc reg data=model;    model r33=a b r4 r8 c d e r23 r24 r29/ selection=forward              sle=.5 maxstep=3;    model r33=a b r4 r8 c d e r23 r24 r29/ selection=backward              sls=0.05 maxstep=3;  run;  ods trace off; 

Create HTML output. The ODS HTML statement opens the HTML destination and creates HTML output.

ods html body='combined.html'; 

Print the reports. The PROC PRINT steps print the data sets that ODS created from PROC REG. The output from these steps is sent to both the HTML destination.

title2 'The First Data Set Has the VARENTERED Column';  proc print data=summary;  run;  title1;  title2 'The Second Data Set Has the VERREMOVED Column';  proc print data=summary1;  run; 

Create a data set that contains all of the data sets. The DATA set summarym combines all the data sets that were created by the ODS OUTPUT statement. The macro variable list contains the list of data set names.

data summarym;     set &list;  run; 

Print the merged report and specify the title. The PROC PRINT step prints the merged data set created from the data step. The output from this step is sent to the HTML destination.

The TITLE1 statement cancels the first title, and the TITLE2 statements specify a new title for the output.

title1;  title2 'The Merged Data Set Has Both Columns';  proc print data=summarym;  run; 

Close the HTML destination. The ODS HTML CLOSE statement closes the HTML destination and all of the files that are associated with it.

ods html close; 

HTML Output

The First Data Set Created When Using the MATCH_ALL Option This HTML output contains a printed report of the summary data set created by the ODS OUTPUT statement with the MATCH_ALL option specified. It has no VERREMOVED column.

The Second Data Set Created When Using the MATCH_ALL Option This HTML output contains a printed report of the summary1 data set created by the ODS OUTPUT statement with the MATCH_ALL option specified. It has no VARENTERED column.

The Merged Data Set Created When Using the MATCH_ALL Option This HTML output contains a printed report of the summarym data set created by the ODS OUTPUT statement with the MATCH_ALL option specified. This is the data set created from summary and summary1 . It contains both the VARENTERED and VERREMOVED columns.

Click To expand
Display 5.10: Three Data Sets Created When Using the MATCH_ALL option

Program 2

Prepare a SAS data set to be created . The ODS OUTPUT statement opens the OUTPUT destination and creates the SAS data set Summary . Because the MATCH_ALL option is not specified, ODS creates one data set that contains all instances of the output object SelectionSummary .

ods output SelectionSummary=summary;  title1 'Without the MATCH_ALL Option, ODS Produces a Single Data Set With All          Of the Columns'; 

Create the output objects and view a record of them in the log. PROC REG creates the output objects.

The ODS TRACE statement writes to the SAS log a record of each output object that is created. The ODS TRACE OFF statement represses the printing of the records.

ods trace on;  proc reg data=model;    model r33=a b r4 r8 c d e r23 r24 r29/ selection=forward              sle=.5 maxstep=3;    model r33=a b r4 r8 c d e r23 r24 r29/ selection=backward              sls=0.05 maxstep=3;  run;  ods trace off; 

Create HTML output. The ODS HTML statement opens the HTML destination and creates HTML output.

ods html body='combined2.html'; 

Print the combined data set. The PROC PRINT step prints the merged data set created by ODS. The output from this step is sent to the HTML destination.

proc print data=summary;  run; 

Close the HTML destination. The ODS HTML CLOSE statement closes the HTML destination and all of the files that are associated with it.

ods html close; 

HTML Output

This HTML output contains a printed report of the summary data set created by the ODS OUTPUT statement without the MATCH_ALL option specified. Note that to merge data sets, you do not have to specify the MATCH_ALL option.

Click To expand
Display 5.11: Using the ODS OUTPUT Statement Without the MATCH_ALL Option to Combine Data Sets

ODS PATH Statement

Specifies locations to write to or read from when creating or using PROC TEMPLATE definitions and the order in which to search for them

Valid: anywhere

Category: ODS: Output Control

Featured in: Example 1 on page 281 and Example 2 on page 283

Tip: This statement overrides the ODS PATH statement for the duration of a PROC TEMPLATE step.

Syntax

PATH <(APPEND) | (PREPEND) | (REMOVE) > location(s) ;

PATH path-argument ;

Required Arguments

location(s)

  • specifies one or more locations to write to or read from when creating or using PROC TEMPLATE definitions and the order in which to search for them. ODS searches the locations in the order that they appear on the statement. It uses the first definition that it finds that has the appropriate access mode (read, write, or update) set.

    • Each location has the following form:

    • < libref. > item-store <(READ | UPDATE | WRITE)>

  • < libref .> item-store

    • identifies an item store to read from, to write to, or to update. If an item store does not already exist, then the ODS PATH statement will create it.

  • (READ | UPDATE | WRITE)

    • specifies the access mode for the definition. The access mode is one of the following:

    • READ

      • provides read-only access.

    • WRITE

      • provides write access (always creating a new template store) as well as read access.

    • UPDATE

      • provides update access (creating a new template store only if the specified one does not exist) as well as read access.

    • Default: READ

  • Default:

    • SASUSER.TEMPLAT (UPDATE)

    • SASHELP.TMPLMST (READ)

    • Note: SAS stores all the definitions that it provides in SASHELP.TMPLMST.

  • Interaction: You can use the PATH statement in a PROC TEMPLATE step to temporarily override the ODS PATH statement (see PATH Statement on page 276).

  • Tip: If you want to be able to ignore all definitions that you create, then keep them in their own item stores so that you can leave them out of the list of item stores that ODS searches.

path-argument

  • specifies the setting or displaying of the ODS path.

    • path-argument can be one of the following:

  • RESET

    • sets the ODS path to the default settings SASUSER.TEMPLAT (UPDATE) and SASHELP.TMPLMST (READ).

  • SHOW

    • displays the current ODS path.

  • VERIFY

    • sets the ODS path to include only templates supplied by SAS. VERIFY is the same as specifying ODS PATH SASHELP.TMPLMST (READ).

Options

(APPEND | PREPEND | REMOVE)

  • adds or removes one or more locations to a path.

  • APPEND

    • adds one or more locations to the end of a path. When you append a location to a path, all duplicate instances (same name and same permissions) of that item store are removed from the path. Only the last item store with the same name and permissions are kept.

  • PREPEND

    • adds one or more locations to the beginning of a path. When you prepend a location with update permissions to a path, all duplicate instances (same name and same permissions) of that item store are removed from the path. Only the first item store with the same name and permissions are kept.

  • REMOVE

    • removes one or more locations from a path.

  • Default: If you do not specify an APPEND, PREPEND, or REMOVE option, then the ODS PATH statement overwrites the complete path.

ODS PCL Statement

Opens, manages, or closes the PCL destination, which produces printable output for PCL (HP LaserJet) files

Valid: anywhere

Category: ODS: Third-Party Formatted

Interaction: By default, when you execute a procedure that uses the FORMCHAR system option (for example, PROC PLOT or PROC CHART), ODS formats the output in SAS Monospace font. If you are creating output that will be viewed in an operating environment where SAS software is not installed, this output will not display correctly because without SAS, the SAS Monospace font is not recognized. To make your document display correctly, include the following statement before your SAS program:

OPTIONS FORMCHAR="|----|+|---+=|-/\<>*"; 
Syntax

ODS PCL <(<ID=> identifier )> < action >;

ODS PCL <(<ID=> identifier )> < option(s) >;

Without an Action or Options

If you use the ODS PCL statement without an action or options, then it opens the PCL destination and creates PCL output.

Actions

An action does one of the following:

  • closes the destination

  • excludes output objects

  • selects output objects

  • writes the current exclusion list or selection list to the SAS log

The following table lists the actions available for the ODS PCL statement. For complete descriptions of actions see Actions on page 160.

Table 5.1: ODS PCL Action Summary Table

Task

action

Close the PCL destination and the file that is associated with it.

CLOSE

Select output objects for the PCL destination.

SELECT

Exclude output objects from the PCL destination.

EXCLUDE

Write to the SAS log the current selection or exclusion list for the PCL destination.

SHOW

Options

The following table lists the options that are available for the ODS PCL statement. For more detailed descriptions of these options, see ODS PRINTER Statement on page 159.

Table 5.2: ODS PCL Option Summary Table

Task

Option

Specify whether or not background colors are printed in text.

BACKGROUND=

Apply a specified color scheme to your output.

COLOR=

Specify the number of columns to create on each page of output.

COLUMNS=

Specify the file to write to.

FILE=

Specify a scaling factor to apply to all the font sizes that do not have an explicit unit of measure.

FONTSCALE=

Open multiple instances of the same destination at the same time.

ID=

Specify that ODS use the printer drivers that SAS provides.

SAS

Control page breaks.

STARTPAGE=

Specify the style definition to use in writing the PCL output.

STYLE=

Insert text into your output.

TEXT=

For tables with multiple pages, ensure uniformity from page to page within a single table.

UNIFORM

Details

Opening and Closing the PCL Destination You can modify an open PCL destination with many ODS PCL options. However, the FILE= and SAS options will automatically close the open destination that is referred to in the ODS PCL statement, and will also close any files associated with it, and then open a new instance of the destination. If you use one of these options, it is best if you explicitly close the destination yourself.

The ODS Printer Family of Statements The ODS PCL statement is part of the ODS printer family of statements. Statements in the printer family open the PCL, PDF, PRINTER, or PS destination, producing output that is suitable for a high-resolution printer. The ODS PDF, ODS PRINTER, and ODS PS statements are also members of the ODS printer family of statements.

See Also

Statements:

  • ODS PDF Statement on page 153

  • ODS PRINTER Statement on page 159

  • ODS PS Statement on page 177

The Third-Party Formatted Destinations on page 27

Commonly Used ODS Terminology on page 21

ODS PDF Statement

Opens, manages, or closes the PDF destination, which produces PDF output, a form of output that is read by Adobe Acrobat Reader and other applications

Valid: anywhere

Category: ODS: Third-Party Formatted

CAUTION:

  • The PDF driver that SAS uses does not recognize all Microsoft Windows fonts. You must enter any such fonts into the SAS registry in order for SAS to find them. For information about the SAS registry, see SAS Language Reference: Concepts .

Syntax

ODS PDF <(<ID=> identifier )> < action >;

ODS PDF <(<ID=> identifier )> < option(s) >;

Without an Action or Options

If you use the ODS PDF statement without an action or options, then it opens the PDF destination and creates PDF output.

Actions

An action does one of the following:

  • closes the destination

  • excludes output objects

  • selects output objects

  • writes the current exclusion list or selection list to the SAS log

The following table lists the actions available for ODS PDF statement. For complete descriptions see Actions on page 160.

Table 5.3: ODS PDF Action Summary Table

Task

action

Close the PDF destination and the file that is associated with it.

CLOSE

Select output objects for the PDF destination.

SELECT

Exclude output objects from the PDF destination.

EXCLUDE

Write to the SAS log the current selection or exclusion list for the PDF destination.

SHOW

Options

The following table lists the options that are available for the ODS PDF statement. For more detailed descriptions of these options, see Options on page 161.

Table 5.4: ODS PDF Option Summary Table

Task

Option

Specify the root name for the anchor tag that identifies each output object in the current file.

ANCHOR=

Insert the text string that you specify as the author in the metadata of a file.

AUTHOR=

Specify whether or not background colors are printed in text.

BACKGROUND=

Specify a string to use as the first part of all references that ODS creates in the file.

BASE=

Specify whether ornot to generateand displaythe list of bookmarks for a PDF file.

BOOKMARKLIST=

Control the generation of bookmarks in a PDF file.

BOOKMARKGEN=

Apply a specified color scheme to your output.

COLOR=

Specify the number of columns to create on each page of output.

COLUMNS=

Specify the file to write to.

FILE=

Specify a scaling factor to apply to all the font sizes that do not have an explicit unit of measure.

FONTSCALE=

Open multiple instances of the same destination at the same time.

ID=

Insert a string of keywords into the output file s metadata.

KEYWORDS=

Control whether notes are added to a PDF file for items that are associated with the FLYOVER= style attribute.

PDFNOTE

Specify that ODS use the printer drivers that SAS provides.

SAS

Control page breaks.

STARTPAGE=

Specify the style definition to use in writing the PDF output.

STYLE=

Insert the text string that you specify as the subject in the metadata of a file.

SUBJECT=

Insert the text string that you specify as the title in the metadata of a file.

TITLE=

Insert text into your output.

TEXT=

For multi-page tables, provide uniformity from page to page within a single table.

UNIFORM

Details

The ODS Printer Family of Statements The ODS PDF statement is part of the ODS printer family of statements. Statements in the printer family open the PCL, PDF, PRINTER, or PS destination, producing output that is suitable for a high-resolution printer. The ODS PCL, ODS PRINTER, and ODS PS statements are also members of the ODS printer family of statements.

Opening and Closing the PDF Destination You can modify an open PDF destination with many ODS PDF options. However, the FILE= and SAS options will automatically close the open destination that is referred to in the ODS PDF statement, and will also close any files associated with it, and then open a new instance of the destination. If you use one of these options, it is best if you explicitly close the destination yourself.

Examples
Example 1: Opening Multiple Instances of the Same Destination at the Same Time

ODS features:

  • ODS PDF statement:

    • Options:

      • ID=

      • STYLE=

      • FILE=

Other SAS features:

  • PROC FORMAT

  • PROC SORT

  • PROC REPORT

  • NOBYLINE

  • BYLINE system option

  • #BYVAL parameter in titles

This example opens multiple instances of the PDF destination to create PDF output. One instance uses the default style definition and the second instance uses the STYLE= option to specify the D3D style definition.

Program

Create the input data set. The data set grain_production contains dataon the amounts of wheat, rice, and corn that five leading grain-producing nations produced during 1995 and 1996. data grain_production;

data grain_production;     length Country $ 3 Type $ 5;     input Year country $ type $ Kilotons;     datalines;  1995 BRZ  Wheat    1516  1995 BRZ  Rice     11236  1995 BRZ  Corn     36276  1995 CHN  Wheat    102207  1995 CHN  Rice     185226  1995 CHN  Corn     112331  1995 IND  Wheat    63007  1995 IND  Rice     122372  1995 IND  Corn     9800  1995 INS  Wheat    .  1995 INS  Rice     49860  1995 INS  Corn     8223  1995 USA  Wheat    59494  1995 USA  Rice     7888  1995 USA  Corn     187300  1996 BRZ  Wheat    3302  1996 BRZ  Rice     10035  1996 BRZ  Corn     31975  1996 CHN  Wheat    109000  1996 CHN  Rice     190100  1996 CHN  Corn     119350  1996 IND  Wheat    62620  1996 IND  Rice     120012  1996 IND  Corn     8660  1996 INS  Wheat    .  1996 INS  Rice     51165  1996 INS  Corn     8925  1996 USA  Wheat    62099  1996 USA  Rice     7771  1996 USA  Corn     236064  ; 

Sort the data set. PROC SORT sorts the data first by values of Year, then by values of Country, and finally by values of Type.

proc sort data=grain_production;     by year country type;  run; 

Create a user-defined format. PROC FORMAT creates the user-defined format $CNTRY.

proc format;     value $cntry 'BRZ'='Brazil'                  'CHN'='China'                  'IND'='India'                  'INS'='Indonesia'                  'USA'='United States';  run; 

Close the LISTING destination so that no listing output is produced. The LISTING destination is open by default. The ODS LISTING statement closes the LISTING destination to conserve resources. (If the destination were left open, then ODS would produce both Listing and PDF output.)

ods listing close; 

Create two different PDF output files at the same time. The ODS PDF statement opens the PDF destination and creates PDF output.

The file grain-1.pdf is created by the first ODS PDF statement. Because no style definition is specified, the default style, styles.printer , is used.

The file grain-2.pdf is created by the second ODS PDF statement with the ID= option specified. The STYLE= option specifies that ODS use the style definition D3D. The ID= option gives this instance of the PDF destination the name d3dstyle . If you do not specify the ID= option, this ODS PDF statement will close the instance of the PDF destination that was opened by the previous ODS PDF statement and open a new instance of the PDF destination. The file grain-1.pdf will contain no output.

ods pdf file="grain-1.pdf";  ods pdf (id=d3dstyle) style=D3d file="grain-2.pdf"; 

Suppress the default BY line, suppress the printing of the date, and use the BY value in a title. The NOBYLINE option suppresses the BY line. The #BYVAL specification inserts the current value of the BY variable Year into the title.

options nobyline nodate;  title 'Leading Grain-Producing Countries';  title2 'for #byval(year)'; 

Produce a report. This PROC REPORT step produces a report on grain production. Each BY group produces a page of output.

proc report data=grain_production nowindows;     by year;     column country type kilotons;     define country  / group width=14 format=$cntry.;     define type     / group 'Type of Grain';     define kilotons / format=comma12.;     footnote 'Measurements are in metric tons.';  run; 

Restore the BY line and clear the second title statement. The BYLINE option restores the BY line. The TITLE2 statement clears the second TITLE statement.

options byline;  title2; 

Produce a report that contains one table for each year. The TABLE statement in this PROC TABULATE step has Year as the page dimension. Therefore, PROC TABULATE explicitly produces one table for 1995 and one for 1996.

proc tabulate data=grain_production format=comma12.;     class year country type;     var kilotons;     table year,           country*type,           kilotons*sum=' ' / box=_page_ misstext='No data';     format country $cntry.;     footnote 'Measurements are in metric tons.';  run; 

Close the open destinations so that you can view or print the output. The ODS PDF CLOSE statement closes the first instance of the PDF destination and all of the files that are associated with it. The ODS PDF (ID=d3dstyle) statement closes the second instance of the PDF destination and all of the files that are associated with it. You must close the destinations before you can view the output with a browser or before you can send the output to a physical printer.

ods pdf close;  ods pdf(id=d3dstyle) close; 

PDF Output

Click To expand
Display 5.12: PDF Output Without Style
Click To expand
Display 5.13: PDF Output Using D3D Style
See Also

Statements:

  • ODS PCL Statement on page 150

  • ODS PRINTER Statement on page 159

  • ODS PS Statement on page 177

  • Commonly Used ODS Terminology on page 21

  • The Third-Party Formatted Destinations on page 27

ODS PHTML Statement

Opens, manages, or closes the PHTML destination, which produces simple HTML output that uses twelve style elements and no class attributes

Valid: anywhere

Category: ODS: Third-Party Formatted

Syntax

ODS PHTML action ;

ODS PHTML < file-specification(s) >< option(s) >;

Options

For a complete list of options, see the ODS MARKUP Statement on page 109.

Details

The ODS PHTML statement is part of the ODS markup family of statements. ODS statements in the markup family produce output that is formatted using one of many different markup languages such as HTML (Hypertext Markup Language), XML (Extensible Markup Language), and LaTeX. SAS supplies many markup languages for you to use ranging from DOCBOOK to TROFF. You can specify a markup language that SAS supplies, or create one of your own and store it as a user-defined markup language.

ODS PRINTER Statement

Opens, manages, or closes the PRINTER destination, which produces printable output

Valid: anywhere

Category: ODS: Third-Party Formatted

Interaction: By default, when you execute a procedure that uses the FORMCHAR system option, (for example, PROC PLOT or PROC CHART), ODS formats the output in SAS Monospace font. If you are creating output that will be viewed in an operating environment where SAS software is not installed, this output will not display correctly, because without SAS, the SAS Monospace font is not recognized. To make your document display correctly, include the following statement before your SAS program:

OPTIONS FORMCHAR="|----|+|---+=|-/\<>*"; 

CAUTION:

  • When you are producing PostScript output, verify that your online viewer or printer is set to use the same paper size as the value that is specified by the OPTIONS PAPERSIZE= statement. Otherwise, some parts of your output might appear to be missing.

Syntax

ODS PRINTER <(<ID=> identifier )> < action >;

ODS PRINTER <(<ID=> identifier )> < option(s) >;

Without an Action or Options

If you use the ODS PRINTER statement in the UNIX, VMS, or OS/390 operating environments without an action or options, then it opens the PRINTER destination and creates PostScript output, unless otherwise configured by your system administrator.

If you use the ODS PRINTER statement in the Windows operating environment without an action or options, then it prints to the default Windows printer.

Actions

An action does one of the following:

  • closes the destination

  • excludes output objects

  • selects output objects

  • writes the current exclusion list or selection list to the SAS log

An action can be one of the following:

CLOSE

  • closes the destination and the file that is associated with it. You cannot print the file until you close the destination.

  • Tip: When an ODS destination is closed, ODS does not send output to that destination. Closing an unneeded destination frees some system resources.

EXCLUDE exclusion(s) | ALL | NONE

  • excludes output objects from the destination.

  • Default: NONE

  • Restriction: The destination must be open for this action to take effect.

  • Main discussion: ODS EXCLUDE Statement on page 90

SELECT selection(s) | ALL | NONE

  • selects output objects for the destination.

  • Default: ALL

  • Restriction: The destination must be open for this action to take effect.

  • Main discussion: ODS SELECT Statement on page 188

SHOW

  • writes the current selection or exclusion list for the destination to the SAS log.

  • Restriction: The destination must be open for this action to take effect.

  • Tip: If the selection or exclusion list is the default list (SELECT ALL), then SHOW also writes the entire selection or exclusion list.

  • See also: ODS SHOW Statement on page 197

Options

ANCHOR= anchor-name

  • specifies the root name for the anchor tag that identifies each output object in the current file.

    Each output object must have an anchor tag for the bookmarks to reference. The references, which are automatically created by ODS, point to the name of an anchor. Therefore, each anchor name in a file must be unique.

  • anchor-name

    • is the root name for the anchor tag that identifies each output object in the current file.

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

    • Requirement: You must enclose anchor-name in quotation marks.

  • Alias: NAMED_DEST= | BOOKMARK=

  • Restriction: Use this option only with the ODS PDF statement, the ODS PS statement with the PDFMARK option specified, and the ODS PRINTER statement with the PDFMARK option specified.

  • Tip: You can change anchor names as often as you want by submitting the ANCHOR= option in a valid statement anywhere in your program. Once you have specified an anchor name, it remains in effect until you specify a new one.

  • Tip: Specifying new anchor names at various points in your program is useful when you want to link to specific parts of your PRINTER output. Because you can control where the anchor name changes, you know in advance what the anchor name will be at those points.

AUTHOR= author-text

  • inserts into the metadata of a file, the text string that you specify as the author.

  • author-text

    • is the text in the metadata of an open file that indicates the author.

  • Restriction: Use this option only with the ODS PDF statement, the ODS PS statement with the PDFMARK option specified, and the ODS PRINTER statement with the PDFMARK option specified.

  • Requirement: You must enclose author-text in quotation marks.

BACKGROUND=NO | YES

  • specifies whether or not background colors are printed in text.

  • NO

    • suppresses the printing of background colors in text.

    • Alias: NOBACKGROUND is an alias for BACKGROUND=NO.

  • YES

    • allows the printing of background colors in text.

    • Alias: BACKGROUND is an alias for BACKGROUND=YES

  • Default: YES

BASE= base-text

  • specifies the text to use as the first part of all references that ODS creates in the output file.

  • base-text

    • is the text that ODS uses as the first part of all references that ODS creates in the file.

      • Consider this specification:

        BASE=http://www.your-company.com/local-url/ 
    • In this case, ODS creates references that begin with the string http://www.your-company.com/local-url/. The appropriate anchor-name completes the link.

  • Restriction: Use this option only with the ODS PDF statement, the ODS PS statement with the PDFMARK option specified, and the ODS PRINTER statement with the PDFMARK option specified.

  • Requirement: You must enclose base-text in quotation marks.

BOOKMARKLIST= HIDE | NONE | SHOW

  • specifies whether or not to generate and display the list of bookmarks for a PDF file.

    Note: The generation of the bookmarks is not affected by the setting of this option. Bookmarks are generated by the BOOKMARKGEN= option.

    HIDE

    generates a list of bookmarks for your PDF file. The bookmarks are not automatically displayed when you open the PDF file.

    NONE

    specifies not to generate a list of bookmarks for your PDF file.

    Alias: NO | OFF

    Alias: NOBOOKMARKLIST is an alias for BOOKMARKLIST=NONE | NO | OFF.

    SHOW

    generates a list of bookmarks for your PDF file. The bookmarks are automatically displayed when you open the PDF file.

    Alias: YES | ON

    Alias: BOOKMARKLIST is an alias for BOOKMARKLIST=SHOW | YES | ON.

  • Default: SHOW

  • Restriction: This option can only be set when you first open the destination.

  • Restriction: This option only has an affect only when creating PDF or PDFMARK output.

  • Interaction: The NOTOC option specifies BOOKMARKLIST= OFF and CONTENTS= OFF.

BOOKMARKGEN= NO | YES

  • controls the generation of bookmarks in a PDF file.

  • NO

    • does not generate bookmarks in the PDF file.

    • Alias: OFF

    • Alias: NOBOOKMARKGEN is an alias for BOOKMARKGEN=NO | OFF.

  • YES

    • generates bookmarks in the PDF file.

    • Alias: ON

    • Alias: BOOKMARKGEN is an alias for BOOKMARKGEN=YES | ON.

    • Default: YES

    • Restriction: This option can only be set when you first open the destination.

    • Interaction: If you set BOOKMARKGEN=NO, then the BOOKMARKLIST option is set to NO also.

COLOR=FULL | GRAY | MONO | NO | YES

  • applies the specified color scheme to your output.

  • FULL

    • creates full color output for both text and graphics.

  • GRAY

    • creates grayscale output for both text and graphics.

    • Alias: GREY

  • MONO

    • creates monochromatic output for both text and graphics.

    • Alias: BW

  • NO

    • does not use all the color information that the style definition provides.

    • Interaction: Specifying COLOR=NO is the same as specifying COLOR=GRAY and BACKGROUND=NO.

    • Tip: If you specify COLOR=NO, then the destination does this:

      • generates black and white output

      • creates all text and rules in black

      • sets the SAS/GRAPH device to produce SAS/GRAPH output in grayscale

      • ignores specifications for a background color from the style definition except for the purposes of determining whether to print rules for the table

  • YES

    • uses all the color information that a style definition provides, including background color.

    • Interaction: Specifying COLOR=YES is the same as specifying COLOR=FULL and BACKGROUND=YES.

  • Default: YES

  • Tip: If you choose color output for a printer that does not support color, then your output might be difficult to read.

  • Tip: In order to actually print in color, you must also

    • use a printer that is capable of printing in color

    • use the COLORPRINTING SAS system option. For information about the COLORPRINTING system option, see SAS Language Reference: Dictionary .

COLUMNS= n

  • specifies the number of columns to create on each page of output.

  • n

    • is the number columns per page.

  • Default: 1

COMPRESS= n

  • controls the compression of a PDF file. Compression reduces the size of the file.

  • n

    • specifies the level of compression. The larger the number, the greater the compression. For example, n =0 is completely uncompressed, and n =9 is the maximum compression level.

  • Default: 6

  • Range: 0 “9

  • Restriction: Use this option only with the ODS PDF statement and the ODS PRINTER statement with the PDF option specified.

CONTENTS= NO | YES

CAUTION:

  • CONTENTS= is an experimental option. Do not use this option in production jobs.

  • controls the generation of a printable table of contents.

  • NO

    • does not generate a printable table of contents.

    • Alias: NOCONTENTS is an alias for CONTENTS=NO

  • YES

    • generates a printable table of contents.

    • Alias: CONTENTS is an alias for CONTENTS=YES

FILE= external-file | fileref

  • specifies the file that contains the output.

  • external-file

    • is the name of an external file to write to.

    • Requirement: You must enclose external-file in quotation marks.

  • fileref

    • is a fileref that has been assigned to an external file. Use the FILENAME statement to assign a fileref.

    • See: For information about the FILENAME statement, see SAS Language Reference: Dictionary .

  • Default: If you do not specify a file to write to, then ODS writes to the file that is specified by one of two SAS system options:

    • SYSPRINT=

      • if you are using the Windows operating environment and do not specify any of the following options: PCL, PDF, PDFMARK, PS, or SAS.

    • PRINTERPATH=

      • in all other cases

    • If the system option does not specify a file, then ODS writes to the default printer. For more information, see the PRINTER= option on page 166.

  • Interaction: In an ODS printer family statement that refers to an open ODS printer destination, the FILE= option forces ODS to close the destination and all files that are associated with it, and to open a new instance of the destination. For more information, see Opening and Closing the Printer Destination on page 170.

  • See: For information about the FILENAME statement, see SAS Language Reference: Dictionary .

FONTSCALE= percent

  • specifies a scaling factor to apply to all the font sizes that do not have an explicit unit of measure.

  • percent

    • is the percent specified. Some SAS style definitions specify the font size as an integer between 1 and 7. When ODS encounters such definitions, the PRINTER destination arbitrarily selects a font size for each integer.

  • Default: 100

  • Restriction: FONTSCALE= has no effect unless it is used in combination with the STYLE= option and a style definition that does not specify units of measure.

HOST

  • specifies that ODS use the printer drivers that the host system provides.

  • Interaction: In an ODS printer family statement that refers to an open ODS printer destination, the HOST option forces ODS to close the destination and all files that are associated with it, and to open a new instance of the destination. For more information, see Opening and Closing the Printer Destination on page 170.

(<ID=> identifier )

  • enables you to open multiple instances of the same destination at the same time. Each instance can have different options.

  • identifier

    • can be numeric or can be a series of characters that begin with a letter or an underscore. Subsequent characters can include letters, underscores, and numerals.

  • Restriction: If identifier is numeric, it must be a positive integer.

  • Requirement: The ID= option must be specified immediately after the destination name.

KEYWORDS= keywords-text

  • inserts into the output file s metadata, a string of keywords . The keywords enable a document management system to do topic-based searches.

  • keywords-text

    • is the string of keywords.

  • Restriction: Use this option only with the ODS PDF statement, the ODS PS statement with the PDFMARK option specified, and the ODS PRINTER statement with the PDFMARK option specified.

  • Requirement: You must enclose keywords-text in quotation marks.

NOTOC

  • specifies that ODS omit the table of contents (Bookmark list) that is produced by default when producing PDF or PDFMARK output.

  • Interaction: The NOTOC option specifies BOOKMARKLIST=OFF and CONTENTS= OFF.

PCL

  • creates PCL output.

  • Restriction: Do not use this option in conjunction with the PDF or PS option.

  • Interaction: If you use the PCL option in an ODS PRINTER statement that refers to an open ODS printer destination, the option will force ODS to close the destination and all files that are associated with it, and to open a new instance of the destination. For more information, see Opening and Closing the Printer Destination on page 170.

PDF

  • creates PDF output.

  • Restriction: Do not use this option in conjunction with the PCL or PS options.

  • Interaction: If you use the PDF option in an ODS PRINTER statement that refers to an open ODS printer destination, the option will force ODS to close the destination and all files that are associated with it, and to open a new instance of the destination. For more information, see Opening and Closing the Printer Destination on page 170.

PDFMARK

  • enables ODS to insert special tags into a PostScript file. When you use software such as Adobe Acrobat (not Adobe Viewer), Acrobat Distiller interprets the tags to create a PDF file that contains the following items:

    • bookmarks for each section of the output and for each table.

    • references for items that are associated with the URL= style attribute.

    • notes for items that are associated with the FLYOVER= style attribute. Notes are optional, and are based on the PDFNOTE option.

    • author, keywords, subject, and title in the metadata of a file.

  • Default: Because using PDFMARK implies PostScript output, SAS automatically uses the PostScript driver that SAS supplies with this option.

  • Restriction: You cannot use the PRINTER= option with the PDFMARK option.

  • Requirement: To create a PDF file, you must use specialized software, such as Adobe Acrobat Distiller to convert the marked -up PostScript file into a PDF formatted file.

  • Interaction: In an ODS printer family statement that refers to an open ODS printer destination, the PDFMARK option forces ODS to close the destination and all files that are associated with it, and to open a new instance of the destination. For more information, see Opening and Closing the Printer Destination on page 170.

  • Tip: Use this option only if you plan to distill the output. Otherwise, it uses excess resources and does not enhance the results.

PDFNOTE | NOPDFNOTE

  • controls whether notes are added to a PDF file for items that are associated with the FLYOVER= style attribute.

  • PDFNOTE

    • adds notes to a PDF file for items that are associated with the FLYOVER= style attribute.

  • NOPDFNOTE

    • modifies the behavior of PDFMARK so that notes are not added to the file for items that are associated with the FLYOVER= style attribute.

  • Default: PDFNOTE

  • Restriction: Use this option only with the ODS PDF statement, the ODS PS statement with the PDFMARK option specified, and ODS PRINTER statement with the PDFMARK option specified.

PRINTER= printer-name

  • creates output that is formatted for the specified printer.

  • printer-name

    • is the name of the printer for which you want output formatted.

  • Requirement: You must enclose printer-name in quotation marks.

  • Restriction: printer-name must match a subkey in either the SAS registry or the Windows printer registry.

  • Tip: The description of the printer includes its destination and device type. If you are using the SAS printer drivers, then you can find a description of the printer in

    • CORE PRINTING PRINTERS printer PRINTER SETUP OUTPUT

    • If you are using the Windows operating environment and you do not specify the SAS option in the ODS PRINTER statement, then a description of the printer is located in the Windows registry.

      Note: printer-name is not necessarily a physical printer. It is a description that tells SAS how to format the output, and where the output is located. For example, it could be a file on a disk.

  • Alias: PRT

  • Default: If you do not specify a printer, then ODS formats the printer output for the printer that is specified by one of two SAS system options:

      • SYSPRINT= if you are using the Windows operating environment and do not specify any of the following options: PCL, PDFMARK, POSTSCRIPT, PS, or SAS.

      • PRINTERPATH= in all other cases.

  • If the system option does not specify a printer, then ODS writes to the default printer driver as specified in the SAS registry or the Windows registry. In the SAS registry, the default printer is specified in

    CORE PRINTING Default Printer

  • Restriction: You cannot use the PRINTER= option with the PCL, PDF, PDFMARK, or PS options.

  • Interaction: In an ODS printer family statement that refers to an open ODS printer destination, the PRINTER= option forces ODS to close the destination and all files that are associated with it, and to open a new instance of the destination. For more information, see Opening and Closing the Printer Destination on page 170.

  • Tip: To see a list of available printers for SAS printing, use the REGEDIT command. The printers are listed in the Registry Editor window under

    CORE PRINTING PRINTERS

PS

  • creates PostScript output.

  • Alias: POSTSCRIPT

  • Restriction: Do not use this option in conjunction with the PDF or PCL options.

  • Tip: Specifying this option is equivalent to specifying both the SAS option and PRINTER= POSTSCRIPT.

  • Interaction: If you use the PS option in an ODS PRINTER statement that refers to an open ODS printer destination, the option will force ODS to close the destination and all files that are associated with it, and to open a new instance of the destination. For more information, see Opening and Closing the Printer Destination on page 170.

SAS

  • specifies that ODS use the printer drivers that the SAS system provides.

  • Interaction: In an ODS printer family statement that refers to an open ODS printer destination, the SAS option forces ODS to close the destination and all files that are associated with it, and to open a new instance of the destination. For more information, see Opening and Closing the Printer Destination on page 170.

STARTPAGE=NEVER | NO | NOW | YES

  • controls page breaks.

    NEVER

    specifies not to insert page breaks, even before graphics procedures.

     

    CAUTION:

       

    Each graph normally requires an entire page. The default behavior forces a new page after a graphics procedure, even if you use STARTPAGE=NO. STARTPAGE=NEVER turns off that behavior, so specifying STARTPAGE= NEVER might cause graphics to overprint.

    NO

    specifies that no new pages be inserted at the beginning of each procedure, or within certain procedures, even if new pages are requested by the procedure code. A new page will begin only when a page is filled or when you specify STARTPAGE=NOW.

     

    CAUTION:

       

    Each graph normally requires an entire page. The default behavior forces a new page after a graphics procedure, even if you use STARTPAGE=NO. STARTPAGE=NEVER turns off that behavior.

     

    Alias: OFF

     

    Tip: When you specify STARTPAGE=NO, system titles and footnotes are still produced only at the top and bottom of each physical page, regardless of the setting of this option. Thus, some system titles and footnotes that you specify might not appear when this option is specified.

    NOW

    forces the immediate insertion of a new page.

     

    Tip: This option is useful primarily when the current value of the STARTPAGE= option is NO. Otherwise, each new procedure forces a new page automatically.

    YES

    inserts a new page at the beginning of each procedure, and within certain procedures, as requested by the procedure code.

     

    Alias: ON

  • Default: YES

STYLE= style-definition

  • specifies the style definition to use in writing the printer output.

  • Default: If you do not specify a style definition, then ODS uses the style definition that is specified in the SAS registry subkey:

    • ODS DESTINATIONS PRINTER Selected Style

    • By default, this value is styles.printer .

  • Main discussion: For a complete discussion of style definitions, see The Default Style Definition for HTML and Markup Languages on page 320.

  • See also: For instructions on making your own user-defined style definitions, see Chapter 10, TEMPLATE Procedure: Creating Tabular Output, on page 367.

SUBJECT= subject-text

  • inserts into the metadata of a file, the text string that you specify as the subject .

  • subject-text

    • is the text in the metadata of a file that indicates the subject.

  • Restriction: Use this option only with the ODS PDF statement, the ODS PS statement with the PDFMARK option specified, and the ODS PRINTER statement with the PDFMARK option specified.

  • Requirement: You must enclose subject-text in quotation marks.

TEXT= text-string

  • inserts a text string into your output.

  • text-string

    • is the text that you want to insert into your output.

  • Requirement: You must enclose text-string in quotation marks.

  • Tip: If you are submitting more than one procedure step and you do not specify the STARTPAGE=NO option, each procedure will force a new page before the output. Therefore, any text that you specify with TEXT= will be on the same page as the previous procedure.

TITLE= title-text

  • inserts into the metadata of a file, the text string that you specify as the title.

  • title-text

    • is the text in the metadata of a file that indicates the title.

  • Restriction: Use this option only with the ODS PDF statement, the ODS PS statement with the PDFMARK option specified, and the ODS PRINTER statement with the PDFMARK option specified.

  • Requirement: You must enclose title-text in quotation marks.

UNIFORM

  • for multiple page tables, ensures uniformity from page to page within a single table. When the UNIFORM option is in effect, ODS reads the entire table before it starts to print it so that it can determine the column widths that are necessary to accommodate all the data. These column widths are applied to all pages of a multiple page table.

    Note: With BY-group processing, SAS writes the results of each BY-group to a separate table, so the output might not be uniform across BY-groups.

  • Default: If you do not specify the UNIFORM option, then ODS prints a table one page at a time. This approach ensures that SAS does not run out of memory while processing very large tables. However, it can also mean that column widths vary from one page to the next.

  • Tip: The UNIFORM option can cause SAS to run out of memory if you are printing a very large table. If this happens, then you can explicitly set the width of each of the columns in the table, and then print the table one page at a time. To do so, you must edit the table definition that you use. For more information, see What Can You Do with a Table Definition? on page 368.

Details

Opening and Closing the Printer Destination You can modify an open PRINTER destination with many ODS PRINTER options. However, any of the following options will automatically close the open destination that is referred to in the ODS PRINTER statement, and will also close any files that are associated with it, and then open a new instance of the destination: FILE=, HOST, PCL, PDF, PDFMARK, PRINTER=, PS, or SAS. If you use one of these options, it is best if you explicitly close the destination yourself.

For example, in the following ODS program, the second ODS PRINTER statement closes the PRINTER destination that is opened by the first ODS PRINTER statement. Therefore, the file brickstyle.ps will not contain output that is formatted with the d3d style. However, the second ODS PRINTER statement does not affect the PS destination that is opened by the ODS PS statement. The PS destination is still open and the file nostyle.ps could be modified.

The ODS PRINTER statement opens the PRINTER destination and creates PostScript output.

ods printer ps style=brick file='brickstyle.ps';  proc print data=statepop;  run; 

The ODS PS statement opens the PS destination and creates PostScript output.

ods ps file='nostyle.ps';  proc print data=statepop;  run; 

The ODS PRINTER statement closes the open PRINTER destination and the files that are associated with it. It then opens a new instance of the PRINTER destination and creates PostScript output.

ods printer ps style=d3d file='d3dstyle.ps';  proc print data=statepop;  run;  ods printer ps close;  ods ps close; 

Printing Output Directly to a Printer Printing output directly to a printer using the ODS PRINTER statement depends on your host operating environment.

Note: To print directly to a printer in the OS/390, UNIX, or VMS operating environment, you can use the FILENAME statement. Specific information about your operating environment is required when using the FILENAME statement. See the SAS documentation for your operating environment before using this statement. Commands are also available in some operating environments that associate a fileref with a file and that break that association.

To send output to a printer when running SAS under this platform

Do this

OS/390

Use the FILENAME statement with the SYSOUT= DATA set option specified. You can then print to the fileref.

Syntax:

 filename your-fileref sysout=a dest=printer-name;  ods printer file=your-fileref; 

Example:

 filename local sysout=a dest=chpljj21;  ods printer file=local; 

UNIX

Use the FILENAME statement with the PIPE command to associate a fileref with your lpr print command.

Syntax:

 filename your-fileref pipe 'lpr -P printer-name';  ods printer file=your-fileref; 

Example:

 filename local pipe 'lpr -p chpljj21';  ods printer file=local; 

VMS

Use the FILENAME statement with the PRINTER device type specified to create a printer fileref that you can print to.

Syntax:

 filename your-fileref printer passall=yes queue=printer-name;  ods printer file=your-fileref; 

Example:

 filename local printer passall=yes queue=chpljj21;  ods printer file=local; 

Windows

If you want to print to your default printer use this code.

Syntax:

 ods printer; 

If you want to print to a printer that is not the default, then use the PRINTER= option to specify the printer name.

Syntax:

 ods printer printer=printer-name; 

Example:

 ods printer printer=chpljj21; 

Note: To find out what printers are available, select Start - > Settings - > Printers from the Taskbar. If a printer is listed there, then you can use it with the ODS PRINTER statement. If the printer name has spaces, then you must put the printer name in quotation marks.

Using ODS PRINTER with Windows When you use the ODS PRINTER statement in the Windows operating environment, ODS will produce output that is formatted for your default Windows printer unless you specify a different printer by using the PRINTER= option on page 166. You can also produce printable output files in PCL, PDF, or PostScript format by using the appropriate option.

Using ODS PRINTER with All Other Hosts When you use the ODS PRINTER statement in any other operating environment, ODS uses the SAS drivers to produce output files in PCL, PDF, or PostScript formats. By default, the ODS PRINTER statement produces PostScript output files. You can also produce printable output files in PCL or PDF format by using the appropriate option or registry setting.

Example
Example 1: Selecting Output for the HTML and PRINTER Destinations

ODS features:

  • ODS _ALL_ CLOSE

  • ODS HTML statement:

    • BODY=

  • ODS PRINTER statement:

    • FILE=

    • PS

  • ODS LISTING statement:

    • CLOSE

  • ODS SELECT statement:

    • with label

    • with name

    • with path

Other SAS features:

  • PROC UNIVARIATE

Data set:

  • Creating the Statepop Data Set on page 620

This example selects three output objects from a UNIVARIATE procedure step to send to both the HTML destination and to the PRINTER destination.

Note: This example uses filenames that might not be valid in all operating environments. To successfully run the example in your operating environment, you might need to change the file specifications. See Appendix 3, ODS HTML Statements for Running Examples in Different Operating Environments, on page 649.

Program

Prevent listing output from being created. The ODS LISTING statement closes the LISTING destination in order to conserve resources.

ods listing close; 

Set the SAS system options. The OPTIONS statement controls several aspects of the PRINTER output. The NODATE system option specifies that SAS not print the date and the time. The NONUMBER system option specifies that SAS not print the page number on the first title line of each page of SAS output. These options do not affect the HTML output.

options nodate nonumber; 

Create HTML output. The ODS HTML statement opens the HTML destination and creates HTML output. BODY= sends all output objects to the external file that you specify. Some browsers require an extension of HTM or HTML on the filename.

ods html body='your_file.html'; 

Create PostScript output. The ODS PRINTER statement opens the PRINTER destination and the PS option specifies PostScript output. FILE= sends all output objects to the external file that you specify.

ods printer ps file='your_file.ps'; 

Specify the output objects to send to the open destinations. The ODS SELECT statement specifies three output objects to send to all open destinations. The first output object is selected by its name, BasicMeasures . The second output object is selected by its label, Tests For Location . These two selection criteria select the output objects for the analysis of both variables. The third output object is selected by its full path Univariate.CityPop_90.ExtremeObs . This selection criterion selects the output object for only one variable, CityPop_90 .

ods select BasicMeasures             'Tests For Location'             Univariate.CityPop_90.ExtremeObs; 

Compute descriptive statistics for two variables. PROC UNIVARIATE computes descriptive statistics for two variables, CityPop_80 and CityPop_90. ODS routes the selected output objects to the HTML and PRINTER destinations.

proc univariate data=statepop mu0=3.5;     var citypop_90 citypop_80;  run; 

Close the open destinations so that you can view or print the output. The ODS _ALL_ CLOSE statement closes all of the open destinations and all of the files that are associated with them. You must close the destinations before you can view the output with a browser, or before you can send the output to a physical printer.

ods _all_ close; 

Reset the default output type to LISTING. The ODS LISTING statement opens the LISTING destination to return ODS to its default setup.

ods listing; 

HTML Output

The HTML output includes three output objects for the variable CityPop_90, and two output objects for the variable CityPop_80.

Click To expand
Display 5.14: HTML Output for the Variables CityPop_90 and CityPop_80

Printer Output

The Printer output includes three output objects for the variable CityPop_90, and two output objects for the variable CityPop_80.

The SAS System

The UNIVARIATE Procedure

Variable: CityPop_90 (1990 metropolitan pop in millions)

Basic Statistical Measures

Location

Variability

Mean

3.877020

Std Deviation

5.16465

Median

2.423000

Variance

26.67364

Mode

.

Range

28.66500

   

Interquartile Range

3.60000

Testsfor Location;Mu0=3.5

Test

Statistic

p Value

Student s t

t

0.521324

Pr >= |t|

0.6044

Sign

M

ˆ’ 9.5

Pr >= |M|

0.0110

Sign Rank

S

ˆ’ 147

Pr >=|S|

0.1706

Extreme Observations

Lowest

Highest

Value

Obs

Value

Obs

0.134

41

10.083

9

0.152

3

12.023

18

0.191

39

16.515

7

0.226

50

28.799

49


Display 5.15: Partial PostScript Output for the Variables CityPop_90 and CityPop_80

ODS PROCLABEL Statement

Enables you to change a procedure label

Valid: anywhere

Category: ODS: Output Control

Interaction: This statement applies to all open destinations, except for the output destination where a procedure label is not an option. However, this setting lasts for only one procedure step. You must issue an ODS PROCLABEL statement for each procedure step that you have.

Syntax

ODS PROCLABEL string ;

Arguments

string

  • is the procedure label that you specify.

Details

ODS PROCLABEL affects the item names in the outer list of the table of contents.

ODS PROCTITLE Statement

Determines whether or not to write the title that identifies the procedure that produces the results in the output

Valid: anywhere

Category: ODS: Output Control

Interaction: This statement applies to all open destinations, except for the output destination where a procedure label is not an option. This setting persists until you issue an ODS NOPROCTITLE statement. You do not have to issue an ODS PROCTITLE statement for each procedure step.

Syntax

ODS PROCTITLE | NOPROCTITLE ;

ODS PROCTITLE

  • writes, in the output, the name of the procedure that produces the results.

    • Note: Not all procedures use a procedure title.

  • Default: ODS PROCTITLE is the default.

ODS NOPROCTITLE

  • suppresses the writing of the title of the procedure that produces the results.

Details

The following table lists the aliases for the ODS PROCTITLE statement:

Statement

Alias

ODS PROCTITLE

ODS PROCTITLE=ON

ODS PTITLE

ODS PTITLE=ON

ODS NOPROCTITLE

ODS PROCTITLE=OFF

ODS NOPTITLE

ODS PTITLE=OFF

ODS PS Statement

Opens, manages, or closes the PS destination, which Produces PostScript (PS) output

Valid: anywhere

Category: ODS: Third-Party Formatted

Interaction: By default, when you execute a procedure that uses the FORMCHAR system option, (for example, PROC PLOT or PROC CHART), ODS formats the output in SAS Monospace font. If you are creating output that will be viewed in an operating environment where SAS software is not installed, this output will not display correctly, because without SAS, the SAS Monospace font is not recognized. To make your document display correctly, include the following statement before your SAS program:

OPTIONS FORMCHAR="|----|+|---+=|-/\<>*"; 

CAUTION:

  • When you are producing PostScript output, verify that your online viewer or printer is set to use the same paper size as the value that is specified by the OPTIONS PAPERSIZE= statement. Otherwise, some parts of your output might appear to be missing.

Syntax

ODS PS <(<ID=> identifier )> < action >;

ODS PS <(<ID=> identifier )> < option(s) >;

Without an Action or Options

If you use the ODS PS statement without an action or options, then it opens the PS destination and creates PostScript output.

Actions

An action does one of the following:

  • closes the destination

  • excludes output objects

  • selects output objects

  • writes the current exclusion list or selection list to the SAS log

The following table lists the actions that are available for the ODS PS statement. For complete descriptions of actions see Actions on page 160.

Table 5.5: ODS PS Action Summary Table

Task

action

Close the PS destination and the file that is associated with it.

CLOSE

Select output objects for the PS destination.

SELECT

Exclude output objects from the PS destination.

EXCLUDE

Write to the SAS log the currentselection or exclusion list for the PS destination.

SHOW

Options

The following table lists the options available for the ODS PS statement. For more detailed descriptions of these options, see Options on page 161.

Table 5.6: ODS PS Option Summary Table

Task

Option

Specify the root name for the anchor tag that identifies each output object in the current file.

ANCHOR=

Insert the text string that you specify as the author in the metadata of a file.

AUTHOR=

Specify whether or not background colors are printed in text.

BACKGROUND=

Specify a string to use as the first part of all references that ODS creates in the file.

BASE=

Specify whether ornot to generateand displaythe list of bookmarks for a PS file.

BOOKMARKLIST=

Control the generation of bookmarks in a PS file.

BOOKMARKGEN=

Apply a specified color scheme to your output.

COLOR=

Specify the number of columns to create on each page of output.

COLUMNS=

Specify the file to write to.

FILE=

Specify a scaling factor to apply to all the font sizes that do not have an explicit unit of measure.

FONTSCALE=

Open multiple instances of the same destination at the same time.

ID=

Insert a string of keywords into the output file s metadata.

KEYWORDS=

Insert special markup which is used when converting a PostScript file to a PDF file.

PDFMARK

Control whether notes are added to a PDF file for items that are associated with the FLYOVER= style attribute.

PDFNOTE

Specify that ODS use the printer drivers that SAS provides.

SAS

Control page breaks.

STARTPAGE=

Specify the style definition to use in writing the PS output.

STYLE=

Insert text into your output.

TEXT=

For multi page tables, ensure uniformity from page to page within a single table.

UNIFORM

Details

The ODS PS statement is part of the ODS printer family of statements. Statements in the printer family open the PCL, PDF, PRINTER, or PS destination, producing output that is suitable for a high-resolution printer. The ODS PCL, ODS PDF, and ODS PRINTER statements are also members of the ODS printer family of statements.

Opening and Closing the PS Destination You can modify an open PS destination with many ODS PS options. However, the FILE=, PDFMARK, and SAS options will automatically close the open destination that is referred to in the ODS PS statement and will also close any files associated with it, and then open a new instance of the destination. If you use one of these options, it is best if you explicitly close the destination yourself.

See Also

Statements:

  • ODS PCL Statement on page 150

  • ODS PDF Statement on page 153

  • ODS PRINTER Statement on page 159

Commonly Used ODS Terminology on page 21

The Third-Party Formatted Destinations on page 27

ODS RESULTS Statement

Tracks ODS output in the Results window

Valid: anywhere

Category: ODS: Output Control

Restriction: Valid in a windowing environment only, not in batch mode.

Alias: ODS RESULTS|NORESULTS;

Syntax

ODS RESULTS ON | OFF;

Arguments

ON

  • Tracks output that is generated by ODS in the Results window.

OFF

  • Turns off the tracking of output that is generated by ODS in the Results window.

Details

Using ODS RESULTS ON sends all output to the Results window. This is the default setting. Using ODS RESULTS OFF disables ODS tracking, and output is not sent to the Results window. The OFF option is recommended for long running jobs such as regression analyses, when you don t want to track all of the output.

ODS RTF Statement

Opens, manages, or closes the RTF destination, which produces output written in Rich Text Format for use with Microsoft Word 2000

Valid: anywhere

Category: ODS: Third-Party Formatted

Interaction: By default, when you execute a procedure that uses the FORMCHAR system option, (for example, PROC PLOT or PROC CHART), ODS formats the output in SAS Monospace font. If you are creating output that will be viewed in an operating environment where SAS software is not installed, this output will not display correctly, because without SAS, the SAS Monospace font is not recognized. To make your document display correctly, include the following statement before your SAS program:

OPTIONS FORMCHAR="|----|+|---+=|-/\<>*"; 
Syntax

ODS RTF <(<ID=> identifier )> action ;

ODS RTF <(<ID=> identifier )> < option(s) >;

Actions

An action does one of the following:

  • closes the destination

  • excludes output objects

  • selects output objects

  • writes the current exclusion list or selection list to the SAS log

An action can be one of the following:

CLOSE

  • closes the RTF destination and any files that are associated with it.

  • Tip: When an ODS destination is closed, ODS does not send output to that destination. Closing an unneeded destination frees some system resources.

EXCLUDE exclusion(s) | ALL | NONE

  • excludes output objects from the RTF destination.

  • Restriction: The destination must be open for this action to take effect.

  • Default: NONE

  • See also: ODS EXCLUDE Statement on page 90

SELECT selection(s) | ALL | NONE

  • selects output objects for the RTF destination.

  • Default: ALL

  • Restriction: The destination must be open for this action to take effect.

  • See also: ODS SELECT Statement on page 188

SHOW

  • writes the current selection or exclusion list for the destination to the SAS log .

  • Restriction: The destination must be open for this action to take effect.

  • See also: ODS SHOW Statement on page 197

  • Tip: If the selection or exclusion list is the default list (SELECT ALL), then SHOW also writes the entire selection or exclusion list.

Options

ANCHOR= anchor-name

  • specifies the base name for the RTF anchor tag that identifies each output object in the current file.

    Each output object must have an anchor tag for the contents, page, and frame files to link to or to reference. The references, which are automatically created by ODS, point to the name of an anchor. Therefore, each anchor name in a file must be unique.

  • anchor-name

    • is the base name for the RTF anchor tag that identifies each output object in the current file.

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

    • Requirement: You must enclose anchor-name in quotation marks.

  • Alias: NAMED_DEST= | BOOKMARK=

  • Tip: Specifying new anchor names at various points in your program is useful when you want other RTF files to link to specific parts of your RTF output. Because you can control where the anchor name changes, you know in advance what the anchor name will be at those points.

  • Tip: You can change anchor names as often as you like by submitting the ANCHOR= option in an ODS RTF statement anywhere in your program. Once you have specified an anchor name, it remains in effect until you specify a new one.

AUTHOR= author-text

  • inserts into the metadata of a file, the text string that you specify as the author.

  • author-text

    • is the text in the metadata of an open file that indicates the author.

  • Requirement: You must enclose author-text in quotation marks.

BASE= base-text

  • specifies the text to use as the first part of references which ODS creates in the output file

  • base-text

    • is the text that ODS uses as the first part of all references that ODS creates in the file.

      • 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/.

  • Requirement: You must enclose base-text in quotation marks.

COLUMNS= n

  • specifies the number of columns to create on each page of output.

  • n

    • is the number of page columns.

  • Default: 1

ENCODING= local- character “set “encoding

  • overrides the encoding for input or output processing (transcodes) of external files.

  • See: For information about the ENCODING= option, see SAS National Language Support (NLS): User s Guide .

FILE= external-file | fileref

  • opens the RTF destination and specifies the RTF file or SAS catalog to write to. This file remains open until you do one of the following actions:

    • close the RTF destination with ODS RTF CLOSE or ODS _ALL_ CLOSE

    • specify another file to write to instead.

  • external-file

    • is the name of an external file to write to.

    • Requirement: You must enclose external-file in quotation marks.

  • fileref

    • is a fileref that has been assigned to an external file. Use the FILENAME statement to assign a fileref.

    • See also: For information about the FILENAME statement, see the section on statements in SAS Language Reference: Dictionary .

    • Requirement: You must enclose fileref in quotation marks.

  • Alias: BODY=

  • Interaction: In an ODS RTF statement that refers to an open RTF destination, the FILE= option forces ODS to close the destination and all files that are associated with it, and to open a new instance of the destination. For more information, see Opening and Closing the RTF Destination on page 186.

  • See also: NEWFILE=

FONTSCALE= percent

  • specifies a scaling factor to apply to all the font sizes that do not have an explicit unit of measure.

  • percent

    • is the percent specified. Some SAS style definitions specify the font size as an integer between 1 and 7. When ODS encounters such definitions, the RTF destination arbitrarily selects a font size for each integer.

  • Default: 100

  • Restriction: FONTSCALE= has no effect unless it is used in combination with the STYLE= option.

GFOOTNOTE | NOGFOOTNOTE

  • controls the location of the footnotes that are defined by the graphics program that generates the RTF output.

  • GFOOTNOTE

    • includes all the currently defined footnotes within the graphics output.

  • NOGFOOTNOTE

    • suppresses all the currently defined footnotes from appearing in the graphics file. Instead, they become part of the RTF file.

  • Default: GFOOTNOTE

  • Restriction: This option applies only to SAS programs that produce one or more graph outputs.

GTITLE | NOGTITLE

  • controls the location of the titles that are defined by the graphics program that generates the RTF 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 RTF file.

  • Default: GTITLE

  • Restriction: This option applies only to SAS programs that produce one or more graph files.

(ID= identifier )

  • identifier

    • can be a number, or a series of characters that begin with a letter or an underscore.

  • Restriction: If identifier is a number, it must be a positive.

  • Requirement: The ID= option must be specified immediately after the destination name.

  • Tip: You can omit the ID= option, and instead use a name or a number to identify the instance.

  • Featured in: Example 1 on page 155

KEEPN | NOKEEPN

  • controls how tables split at pages.

  • KEEPN

    • ODS does not allow a table to split at a page break unless the entire table cannot fit on one page.

  • NOKEEPN

    • ODS allows a table to split at a page break.

  • Tip: Although KEEPN minimizes page breaks in tables, it might use substantially more paper than NOKEEPN because it issues a page break before starting to print any table that does not fit on the remainder of the page.

NEWFILE= starting-point

  • creates a new file at the specified starting-point .

    • starting-point can be one of the following:

  • BYGROUP

    • starts a new file for the results of each BY group.

  • NONE

    • writes all output to the next file that is opened, and then stops incrementing.

  • OUTPUT

    • starts a new file for the results of each BY group.

    • Alias: TABLE

  • PROC

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

    • Default: NONE

  • ODS automatically names new files by incrementing the name of the body file. For example, if you specify FILE= REPORT.RTF , then ODS names the first file REPORT.RTF. Additional files are named REPORT1.RTF, REPORT2.RTF, and so on. If you end the file name with a number, then ODS begins incrementing with that number. For example, if you specify FILE= MAY5.RTF , then ODS names the first file MAY5.RTF. Additional files are named MAY6.RTF, MAY7.RTF, and so on.

  • Restriction: The NEWFILE= and TEXT= options cannot be used together in the same ODS RTF statement. You must use a separate ODS RTF statement for each of these options.

NOGFOOTNOTE

  • See the description of GFOOTNOTE | NOFOOTNOTE in this section.

NOGTITLE

  • See the description of GTITLE | NOGTITLE in this section.

OPERATOR= text-string

  • inserts into the metadata of the RTF file, the text you specify.

  • text-string

    • is the text in the metadata of a file that indicates the author.

    • Requirement: You must enclose text-string in quotation marks.

RECORD_SEPARATOR= alternative-separator | NONE

  • specifies an alternative record separator, which is a character or string that separates lines in the output files.

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

  • alternative-separator

    • represents one or more characters, in hexadecimal or ASCII format. 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 
    • Requirement: You must enclose alternative-separator in quotation marks.

  • NONE

    • produces RTF output that is appropriate for the environment in which you run the SAS job.

    • Operating Environment Information: In many operating environments, using a value of NONE is the same as omitting the RECORD_SEPARATOR option.

    • 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, then the lines are concatenated.

      If you want to format the RTF files so that you can read them with an editor, then use RECORD_SEPARATOR= NONE. In this case, ODS writes one line of RTF 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. Otherwise, RTF might wrap to another line at an inappropriate place.

  • Alias:

    • RECSEP=

    • RS=

SASDATE

  • writes to the RTF file that the time and the date that you submitted your SAS program, instead of the time that the RTF file was opened.

  • Restriction: You can only specify SASDATE when a new file is opened. If you specify the option at any other time, a warning message is written to the SAS log.

STARTPAGE= YES | NO | NOW

  • controls page breaks.

  • YES

    • inserts a new page at the start of each procedure and within certain procedures, as requested by the procedure code.

    • Alias: ON

  • NO

    • specifies that no new pages be inserted explicitly at the start of each procedure or within certain procedures, even if new pages are requested by the procedure code. A new page will begin only when a page is filled or when you specify STARTPAGE= NOW.

    • Alias: NEVER

    • Tip: This option prints only the first set of titles and the first set of footnotes to the RTF file.

  • NOW

    • forces the immediate insertion of a new page.

    • Tip: This option is useful primarily when the current value of the STARTPAGE= option is NO. Otherwise, each new procedure forces a new page automatically.

  • Tip: Specifying STARTPAGE= NO suppresses forced page breaks. You can turn on forced page breaking again by specifying STARTPAGE= YES. You can insert a page break by specifying STARTPAGE=NOW when you want a page break.

  • Default: YES

STYLE= style-definition

  • specifies the style definition to use in writing the RTF files.

  • style-definition

    • describes how to display the presentation aspects (color, font face, font size, and so on) of your SAS output. A style definition determines the overall appearance of the documents that use it. Each style definition is composed of style elements.

    • Main discussion: For a complete discussion of style definitions, see Overview: ODS Style Definitions on page 285.

    • See also: For instructions on making your own user-defined style definitions, see Chapter 9, TEMPLATE Procedure: Creating a Style Definition, on page 285.

  • Default: If you do not specify a style definition, then ODS uses the file that is specified in the SAS registry subkey:

    • ODS DESTINATIONS RTF Selected Style

    • By default, this value specifies styles.RTF .

TEXT= text-string

  • inserts text into your RTF output.

  • text-string

    • is the text that you want to insert into your RTF output. You can also use TEXT= to annotate other output.

  • Restriction: The NEWFILE= and TEXT= options cannot be used together in the same ODS RTF statement. You must use a separate ODS RTF statement for each of these options.

  • Requirement: You must enclose text-string in quotation marks.

TITLE= title-text

  • inserts into the metadata of a file, the text string that you specify as the title.

  • title-text

    • is the text in the metadata of a file that indicates the title.

  • Requirement: You must enclose title-text in quotation marks.

TRANTAB= translation-table

  • specifies the translation table to use when transcoding a file for output.

  • See: For information about the TRANTAB= option see SAS National Language Support (NLS): User s Guide .

Details

Opening and Closing the RTF Destination You can modify an open RTF destination with many ODS RTF options. However, the FILE= option will automatically close the open destination that is referred to in the ODS RTF statement and will also close any files associated with it, and then open a new instance of the destination. If you use one of these options, it is best if you explicitly close the destination yourself.

How Does RTF Format Output? RTF produces output for Microsoft Word 2000. Although there are other applications that can read RTF files, the RTF output might not work successfully with them.

The RTF destination enables you to view and edit the RTF output. ODS does not define the "vertical measurement," meaning that SAS does not determine the optimal place to position each item on the page. For example, page breaks are not always fixed because when you edit your text, you do not want your RTF output tables to split at inappropriate places. Your tables can remain intact on one page, or can have logical breaks where you specified.

However, because Microsoft Word needs to know the widths of table columns and it cannot adjust tables if they are too wide for the page, ODS measures the width of the text and tables (horizontal measurement). Therefore, all the column widths can be set properly by SAS and the table can be divided into panels if it is too wide to fit on a single page.

In short, when producing RTF output for input to Microsoft Word, SAS determines the horizontal measurement and Microsoft Word controls the vertical measurement. Because Microsoft Word can determine how much room there is on the page, your tables will display consistently even after you modify your RTF file.

Note: The creation of complex tables that contain a large number of observations can reduce system efficiencies and slow down processing time.

ODS RTF and Graphics ODS RTF produces output in rich text format , that supports three formats for graphics that can be read by MS Word.

Format for graphics

Corresponding SAS graphics driver

emfblips

SASEMF

pngblips

PNG

jpegblips

JPEG

When no target device is specified, the default target is SASEMF . The SASEMF graphics device is used as the default when you specify a driver other than SASEMF, PNG, or JPEG.

You can also use the ACTIVEX, ACTXIMG, JAVAIMG graphics drivers to generate graphics in your RTF documents. The ACTIVEX driver generates an ActiveX control. The ACTXIMG and JAVAIMG drivers generate PNG files. For more information about graphics devices, see SAS/GRAPH Reference, Volumes 1 and 2 .

ODS SELECT Statement

Specifies output objects for ODS destinations

Valid: anywhere

Category: ODS: Output Control

See Also: ODS EXCLUDE Statement on page 90

Tip: 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 that you route output to.

Syntax

ODS < ODS-destination > SELECT selection(s) | ALL | NONE;

Arguments

selection(s)

  • specifies output objects to add to a selection list. ODS sends the items in the selection list to all active ODS destinations. By default, ODS automatically modifies selection lists when a DATA step that uses ODS or a procedure step ends. For information about modifying these lists, see Selection and Exclusion Lists on page 34. For information about ending DATA and procedure steps, see the section on DATA Step Processing in SAS Language Reference: Concepts .

    • Each selection has the following form:

    • output-object <(PERSIST)>

  • output-object

    • specifies the output object to select.

      To specify an output object, you need to know which output objects your SAS program produces. The ODS TRACE statement writes to the SAS log a trace record that includes the path, the label, and other information about each output object that is produced. You can specify an output object as

      • a full path. For example,

        Univariate.City_Pop_90.TestsForLocation 

        is the full path of the output object.

      • a partial path. A partial path consists of any part of the full path that begins immediately after a period (.) and continues to the end of the full path. For example, if the full path is

        Univariate.City_Pop_90.TestsForLocation 

        then the partial paths are:

        City_Pop_90.TestsForLocation  TestsForLocation 
      • a label that is enclosed by quotation marks.

        For example,

        "The UNIVARIATE Procedure" 
      • a label path. For example, the label path for the output object is

        "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location" 

        Note: The trace record shows the label path only if you specify the LABEL option in the ODS TRACE statement.

      • a partial label path. A partial label path consists of any part of the label that begins immediately after a period (.) and continues to the end of the label. For example, if the label path is

        "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location" 

        then the partial label paths are:

        "CityPop_90"."Tests For Location"  "Tests For Location" 
      • a mixture of labels and paths.

      • any of the partial path specifications, followed by a pound sign (#) and a number. For example, TestsForLocation#3 refers to the third output object that is named TestsForLocation.

    • See also: ODS TRACE Statement on page 197

  • (PERSIST)

    • keeps the output-object that precedes the PERSIST option in the selection list, even if the DATA or procedure step ends, until you explicitly modify the list with

      • any ODS EXCLUDE statement

      • ODS SELECT NONE

      • ODS SELECT ALL

      • an ODS SELECT statement that applies to the same output object but does not specify PERSIST.

    • Requirement: You must enclose PERSIST in parentheses.

ALL

  • specifies that ODS send all of the output objects to the open destination.

  • Alias: ODS SELECT DEFAULT

  • Interaction: If you specify ALL without specifying a destination, ODS sets the overall list to SELECT ALL and sets all other lists to their defaults.

NONE

  • specifies that ODS does not send any output objects to the open destination.

  • Interaction: If you specify NONE without specifying a destination, ODS sets the overall list to SELECT NONE and sets all other lists to their defaults.

  • Tip: Using the NONE action is different from closing a destination. The output destination is still open, but ODS is restricting the output that it sends to the destination.

  • Tip: To temporarily suspend a destination, use ODS SELECT NONE. Use ODS SELECT ALL when you want to resume sending output to the suspended destination.

Options

ODS-destination

  • specifies which ODS destination s selection list to write to, where ODS-destination can be any valid ODS destination. For a discussion of ODS destinations, see What Are the ODS Destinations? on page 25.

  • Default: If you omit ODS-destination , ODS writes to the overall selection list.

  • Tip: To set the selection list for the Output destination to something other than the default, see the ODS OUTPUT Statement on page 135.

Example
Example 1: Using a Selection List with Multiple Procedure Steps

ODS features:

  • ODS SELECT statement:

    • with label

    • with name

    • with and without PERSIST

    • ALL

  • ODS SHOW statement

  • ODS HTML statement:

    • BODY=

    • CONTENTS=

    • FRAME=

    • PAGE=

Other SAS features:

  • PROC GLM

  • PROC PRINT

  • PROC PLOT

This example runs the same procedures multiple times to illustrate how ODS maintains and modifies a selection list. The ODS SHOW statement writes the overall selection list to the SAS log. The example does not alter selection lists for individual destinations, so the contents file that is generated by the ODS HTML statement shows which output objects are routed to both the HTML and the LISTING destinations.

Note: This example uses filenames that might not be valid in all operating environments. To successfully run the example in your operating environment, you might need to change the file specifications. See Appendix 3, ODS HTML Statements for Running Examples in Different Operating Environments, on page 649.

This example creates and prints data sets from the parameter estimates that PROC GLM generates. This procedure is part of SAS/STAT software.

Program

Create the input data set. The data set IRON contains data from Draper and Smith (p. 98). [*] Thirteen specimens of 90/10 copper -nickel alloys were tested in a corrosion-wheel setup in order to examine corrosion. Each specimen had a specified iron content. The wheel was rotated in salt sea water at 30 ft/sec for 60 days. Weight loss was used to quantify the corrosion. FE represents the iron content, and LOSS denotes the weight loss in milligrams/square decimeter/day.

data iron;     input Fe Loss @@;     datalines;  0.01 127.6   0.48 124.0   0.71 110.8   0.95 103.9  1.19 101.5   0.01 130.1   0.48 122.0   1.44  92.3  0.71 113.1   1.96  83.7   0.01 128.0   1.44  91.4  1.96 86.2  ; 

Create HTML output. The ODS HTML statement opens the HTML destination and creates HTML output. The output from the procedures is sent to the file odspersist-body.htm . The FRAME=, CONTENTS=, and PAGE= options create the files odspersist-frame.htm , odspersist-contents.htm , and odspersist-page.htm , respectively. These files, together with the file odspersist-body.htm , create a frame that includes a table of contents and a table of pages that link to the contents of the body file.

ods html body='odspersist-body.htm'          frame='odspersist-frame.htm'       contents='odspersist-contents.htm'           page='odspersist-page.htm'  ; 

Write the overall selection list to the SAS log. The ODS SHOWstatement writes to the SAS log the overall list, which is set to SELECT ALL by default. See [1] in SAS Log on page 194.

ods show; 

Specify the output objects that will be sent to the open destinations. The ODS SELECT statement determines which output objects ODS sends to the LISTING and HTML destinations. In this case, ODS sends all output objects that are named ParameterEstimates and all output objects that are labeled Type III Model ANOVA to the two destinations.

ods select ParameterEstimates             "Type III Model ANOVA"; 

Write the modified overall selection list to the SAS log. The ODS SHOW statement writes to the SAS log the overall selection list, which now contains the two items that were specified in the ODS SELECT statement. See [2] in the SAS Log on page 194.

ods show; 

Create the output objects and send the selected output objects to the open destinations. As PROC GLM sends each output object to the Output Delivery System, ODS sends the two output objects from PROC GLM that match the items in the selection list to the open destinations. See 1. in the table of contents in HTML Output on page 196. Note that it is the label of an output object, not its name, that appears in the table of contents. The label for ParameterEstimates is Solution .

proc glm data=iron;     model loss=fe;     title 'Parameter Estimates and Type III Model ANOVA';  run; 

Write the overall selection list to the SAS log. PROC GLM supports run-group processing. Therefore, the RUN statement does not end the procedure, and ODS does not automatically modify the selection list. See [3] in the SAS Log on page 194.

ods show; 

End the GLM procedure. The QUIT statement ends the procedure. ODS removes all objects that are not specified with PERSIST from the selection list. Because this action removes all objects from the list, ODS sets the list to its default, SELECT ALL.

quit; 

Write the current selection list to the SAS log. The ODS SHOW statement writes the current selection list to the SAS log. See [4] in the SAS Log on page 194.

ods show; 

Create the output objects, send the selected output objects to the open destinations, and end the procedure. As PROC GLM sends each output object to the Output Delivery System, ODS sends all the output objects to the HTML and LISTING destinations. See 2. in the table of contents in HTML Output on page 196.

The QUIT statement ends the procedure. Because the list uses the argument ALL, ODS does not automatically modify it when the PROC step ends.

proc glm data=iron;     model loss=fe;     title 'All Output Objects Selected';  run;  quit; 

Modify the overall selection lists. This ODS SELECT statement modifies the overall selection list so that it sends all output objects that are named OverallANOVA , and all output objects that are labeled Fit Statistics , to both the HTML and LISTING destinations. The PERSIST option specifies that OverallANOVA should remain in the selection list when ODS automatically modifies it.

ods select OverallANOVA(persist) "Fit Statistics"; 

Create the output objects and send the selected output objects to the open destinations. As PROC GLM sends each output object to the Output Delivery System, ODS sends the two output objects from PROC GLM that match the items in the selection list to the HTML and LISTING destinations. See 3. the table of contents in HTML Output on page 196.

proc glm data=iron;     model loss=fe;     title 'OverallANOVA and Fitness Statistics';  run; 

End the GLM procedure and automatically modify the selection list. When the QUIT statement ends the procedure, ODS automatically modifies the selection list. Because OverallANOVA was specified with the PERSIST option, it remains in the selection list. Because Fitness Statistics was not specified with the PERSIST option, ODS removes it from the selection list.

quit; 

Write the current selection list to the SAS log. The ODS SHOW statement writes the current selection list to the SAS log. See [5] in the SAS Log on page 194.

ods show; 

Create the output objects and send the selected output objects to the open destinations. As PROC GLM sends each output object to the Output Delivery System, ODS sends only the output object that is named OverallANOVA to the HTML and LISTING destinations. See 4. in the table of contents in HTML Output on page 196.

proc glm data=iron;     model loss=fe;     title 'OverallANOVA';     title2 'Part of the Selection List Persists';  run; 

End the GLM procedure and automatically modify the selection list. When the QUIT statement ends the procedure, ODS automatically modifies the selection list. Because OverallANOVA was specified with the PERSIST option, it remains in the selection list.

quit; 

PROC PRINT does not produce any output that is named OverallANOVA . Therefore, no PROC PRINT output is sent to the ODS destinations.

proc print data=iron;     title 'The IRON Data Set';  run; 

Reset all selection lists. This ODS SELECT statement resets all selection lists to their defaults.

ods select all; 

Create the plots. As PROC PLOT creates and sends each output object to the Output Delivery System, ODS sends each one to the HTML and LISTING destinations because their lists and the overall list is set to SELECT ALL (the default).

proc plot data=iron;     plot fe*loss='*' / vpos=25 ;     label fe='Iron Content'         loss='Weight Loss';     title 'Plot of Iron Versus Loss';  run; 

End the PLOT procedure. The QUIT statement ends the PLOT procedure. Because the list uses the argument ALL, ODS does not automatically modify the list when the PROC step ends.

quit; 

Close the HTML destination. This ODS HTML statement closes the HTML destination and all the files that are associated with it.

ods html close; 
SAS Log
Output 5.4: The ODS SHOW Statement Writes the Current Selection List to the SAS Log.
Start example
10   ods html body='odspersist-body.htm'  11        contents='odspersist-contents.htm'  12           frame='odspersist-frame.htm'  13            page='odspersist-page.htm';  NOTE: Writing HTML Body file: odspersist-body.htm  NOTE: Writing HTML Contents file: odspersist-contents.htm  NOTE: Writing HTML Pages file: odspersist-page.htm  NOTE: Writing HTML Frames file: odspersist-frame.htm  14   ods show;  Current OVERALL select list is: ALL   [1]  15   ods select ParameterEstimates  16              "Type III Model ANOVA";  17   ods show;  Current OVERALL select list is:    [2]  1. ParameterEstimates  2. "Type III Model ANOVA"  18   proc glm data=iron;  19      model loss=fe;  20      title 'Parameter Estimates and Type III Model ANOVA';  21   run;  22   ods show;  Current OVERALL select list is:    [3]  1. ParameterEstimates  2. "Type III Model ANOVA"  23   quit;  NOTE: PROCEDURE GLM used:        real time           x.xx seconds        cpu time            x.xx seconds  24   ods show;  Current OVERALL select list is: ALL   [4]  25   proc glm data=iron;  26      model loss=fe;  27      title 'All Output Objects Selected';  28   run;  29   quit;  NOTE: PROCEDURE GLM used:        real time           x.xx seconds        cpu time            x.xx seconds  30   ods select OverallANOVA(persist) "Fit Statistics";  31   proc glm data=iron;  32      model loss=fe;  33      title 'OverallANOVA and Fitness Statistics';  34   run;  35   quit;  NOTE: PROCEDURE GLM used:        real time           x.xx seconds        cpu time            x.xx seconds  36  37  ods show;  Current OVERALL select list is:    [5]  1. OverallANOVA(PERSIST)  38  proc glm data=iron;  39     model loss=fe;  40     title 'OverallANOVA';  41     title2 'Part of the Selection List Persists';  42  run;  43  quit;  NOTE: PROCEDURE GLM used:        real time           x.xx seconds        cpu time            x.xx seconds  44  proc print data=iron;  45     title 'The IRON Data Set';  46  run;  NOTE: PROCEDURE PRINT used:        real time           x.xx seconds        cpu time            x.xx seconds  47  ods select all;  48  proc plot data=iron;  49     plot fe*loss='*' / vpos=25 ;  50     label fe='Iron Content'  51         loss='Weight Loss';  52     title 'Plot of Iron Versus Loss';  53  run;  54  quit; 
End example
 
HTML Output

The contents file shows which output objects from each procedure were sent to the open ODS destinations. You can see that no output was written to the HTML destination for PROC PRINT (because it did not produce anything whose name matched the name in the selection list). You can also see that the PROC PLOT output was written to the HTML destination after the ODS SELECT ALL statement was executed.

Click To expand
Display 5.16: Contents File Produced by the ODS HTML Statement
See Also

Statements:

  • ODS EXCLUDE Statement on page 90

  • ODS SHOW Statement on page 197

  • ODS TRACE Statement on page 197

ODS SHOW Statement

Writes the specified selection or exclusion list to the SAS log

Valid: anywhere

Category: ODS: Output Control

Syntax

ODS < ODS-destination > SHOW ;

Options

ODS-destination

  • specifies which ODS destination s selection or exclusion list to write to the SAS log, where ODS-destination can be any valid ODS destination. For information about ODS destinations, see What Are the ODS Destinations? on page 25. For information on selection and exclusion lists, see Selection and Exclusion Lists on page 34.

  • Default: If you omit ODS-destination , ODS SHOW writes the overall selection or exclusion list.

See Also

Statements:

  • ODS EXCLUDE Statement on page 90

  • ODS SELECT Statement on page 188

  • ODS TRACE Statement on page 197

ODS TRACE Statement

Writes to the SAS log a record of each output object that is created, or else suppresses the writing of this record

Valid: anywhere

Category: ODS: Output Control

Default: OFF

Featured in: Example 3 on page 145

Syntax

ODS TRACE ON</ option(s) >;

ODS TRACE OFF;

Arguments

OFF

  • turns off the writing of the trace record.

ON

  • turns on the writing of the trace record.

  • Alias: OUTPUT

Options

LABEL

  • includes the label path for the output object in the record. You can use a label path anywhere that you can use a path.

  • Tip: This option is most useful for users who are running a localized version of SAS because the labels are translated from English to the local language. The names and paths of output objects are not translated because they are part of the syntax of the Output Delivery System.

LISTING

  • writes the trace record to the Listing destination, so that each part of the trace record immediately precedes the output object that it describes.

Details

Contents of the Trace Record ODS produces an output object by combining data from the data component with a table definition. The trace record provides information about the data component, the table definition, and the output object. By default, the record that the ODS TRACE statement produces contains these items:

  • Name

    • is the name of the output object. You can use the name to reference this output object and others with the same name. For details on how to reference an output object, see How Does ODS Determine the Destinations for an Output Object? on page 35. For example, you could use this name in an ODS OUTPUT statement to make a data set from the output object, or you could use it in an ODS SELECT or an ODS EXCLUDE statement.

    • Tip: The name is the rightmost part of the path that appears in the trace record.

  • Label

    • briefly describes the contents of the output object. This label also identifies the output object in the Results window.

  • Data name

    • is the name of the data component that was used to create this output object. The data name appears only if it differs from the name of the output object.

  • Data label

    • describes the contents of the data.

  • Template

    • is the name of the table definition that ODS used to format the output object. You can modify this definition with PROC TEMPLATE. See the EDIT statement EDIT Statement on page 373 for more information.

  • Path

    • is the path of the output object. You can use the path to reference this output object. For example, you could use the path in the ODS OUTPUT statement to make a data set from the output, or you could use it in an ODS SELECT or an ODS EXCLUDE statement.

The LABEL option modifies the trace record by including the label path for the object in the record. See the discussion of the LABEL option.

Specifying an Output Object Once you have determined which output objects your SAS program produces, you can specify the output objects in statements such as ODS EXCLUDE, ODS SELECT, and so on. You can specify an output object by using one of the following:

  • a full path. For example,

    Univariate.City_Pop_90.TestsForLocation 

    is the full path of the output object.

  • a partial path. A partial path consists of any part of the full path that begins immediately after a period (.) and continues to the end of the full path. For example, if the full path is

    Univariate.City_Pop_90.TestsForLocation 

    then the partial paths are:

    City_Pop_90.TestsForLocation  TestsForLocation 
  • a label that is enclosed by quotation marks.

    For example,

    "The UNIVARIATE Procedure" 
  • a label path. For example, the label path for the output object is

    "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location" 

    Note: The trace record shows the label path only if you specify the LABEL option in the ODS TRACE statement.

  • a partial label path. A partial label path consists of any part of the label that begins immediately after a period (.) and continues to the end of the label. For example, if the label path is

    "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location" 

    then the partial label paths are:

    "CityPop_90"."Tests For Location"  "Tests For Location" 
  • a mixture of labels and paths.

  • any of the partial path specifications, followed by a pound sign (#) and a number. For example, TestsForLocation#3 refers to the third output object that is named TestsForLocation.

Example
Example 1: Determining Which Output Objects a Procedure Creates

ODS features:

  • ODS TRACE statement:

    • LABEL

    • OFF

    • ON

Other SAS features:

  • PROC UNIVARIATE

Data set:

  • STATEPOP Creating the Statepop Data Set on page 620

This example shows how to determine the names and labels of the output objects that a procedure creates. You can use this information to select and exclude output objects.

Note: This example uses filenames that might not be valid in all operating environments. To successfully run the example in your operating environment, you might need to change the file specifications. See Appendix 3, ODS HTML Statements for Running Examples in Different Operating Environments, on page 649.

Program

Specify that SAS write the trace record to the SAS log and include label paths. This ODS TRACE statement writes the trace record to the SAS log. The LABEL option includes label paths in the trace record.

ods trace on / label; 

Create descriptive statistics for two variables. PROC UNIVARIATE computes descriptive statistics for two variables, CityPop_80 and CityPop_90. As PROC UNIVARIATE sends each output object to the Output Delivery System, ODS writes the pertinent information for that output object to the trace record.

proc univariate data=statepop mu0=3.5;     var citypop_90 citypop_80;  run; 

Specify that SAS stop writing the trace record. The ODS TRACE OFF statement stops the writing of the trace record to the SAS log.

ods trace off; 
SAS Log

This partial SAS log shows the trace record that the ODS TRACE statement creates. For each analysis variable PROC UNIVARIATE creates five output objects : Moments , BasicMeasures , TestsForLocation , Quantiles , and ExtremeObs .

Notice that an output object has the same name and label, regardless of which variable is analyzed. Therefore, you can select all the moments tables that PROC UNIVARIATE produces by using the name or label in an ODS SELECT statement. On the other hand, the path and label path are unique for each output object because they include the name of the variable that is analyzed . You can, therefore, select an individual moments table by using the path or the label path in an ODS SELECT statement.

Output Added:  ------------- Name:       Moments  Label:      Moments  Template:   base.univariate.Moments  Path:       Univariate.CityPop_90.Moments  Label Path: "The Univariate Procedure"."CityPop_90"."Moments"  ------------- Output Added:  ------------- Name:       BasicMeasures  Label:      Basic Measures of Location and Variability  Template:   base.univariate.Measures  Path:       Univariate.CityPop_90.BasicMeasures  Label Path: "The Univariate Procedure"."CityPop_90"."Basic Measures of Location and Variability"  ------------- Output Added:  ------------- Name:       TestsForLocation  Label:      Tests For Location  Template:   base.univariate.Location  Path:       Univariate.CityPop_90.TestsForLocation  Label Path: "The Univariate Procedure"."CityPop_90"."Tests For Location"  ------------- Output Added:  ------------- Name:       Quantiles  Label:      Quantiles  Template:   base.univariate.Quantiles  Path:       Univariate.CityPop_90.Quantiles  Label Path: "The Univariate Procedure"."CityPop_90"."Quantiles"  ------------- Output Added:  ------------- Name:       ExtremeObs  Label:      Extreme Observations  Template:   base.univariate.ExtObs  Path:       Univariate.CityPop_90.ExtremeObs  Label Path: "The Univariate Procedure"."CityPop_90"."Extreme Observations"  ------------- Output Added:  ------------- Name:       Moments  Label:      Moments  Template:   base.univariate.Moments  Path:       Univariate.CityPop_80.Moments  Label Path: "The Univariate Procedure"."CityPop_80"."Moments"  ------------- Output Added:  ------------- Name:       BasicMeasures  Label:      Basic Measures of Location and Variability  Template:   base.univariate.Measures  Path:       Univariate.CityPop_80.BasicMeasures  Label Path: "The Univariate Procedure"."CityPop_80"."Basic Measures of Location and Variability"  ------------- Output Added:  ------------- Name:       TestsForLocation  Label:      Tests For Location  Template:   base.univariate.Location  Path:       Univariate.CityPop_80.TestsForLocation  Label Path: "The Univariate Procedure"."CityPop_80"."Tests For Location"  ------------- Output Added:  ------------- Name:       Quantiles  Label:      Quantiles  Template:   base.univariate.Quantiles  Path:       Univariate.CityPop_80.Quantiles  Label Path: "The Univariate Procedure"."CityPop_80"."Quantiles"  ------------- Output Added:  ------------- Name:       ExtremeObs  Label:      Extreme Observations  Template:   base.univariate.ExtObs  Path:       Univariate.CityPop_80.ExtremeObs  Label Path: "The Univariate Procedure"."CityPop_80"."Extreme Observations"  -------------
See Also

Statements:

  • ODS EXCLUDE Statement on page 90

  • ODS SELECT Statement on page 188

ODS USEGOPT Statement

Determines whether or not ODS uses graphics option settings

Valid: anywhere

Category: ODS: Output Control

See also: SAS/GRAPH Reference, Volumes 1 and 2

Syntax

ODS USEGOPT | NOUSEGOPT ;

ODS USEGOPT

  • specifies that ODS use graphics option settings for non-graphical output.

ODS NOUSEGOPT

  • specifies that ODS not use graphics option settings for non-graphical output.

Details

Enabling Graphics Options While ODS USEGOPT is in effect, the settings for the following graphics options will affect all of your ODS output, including tables:

  • CTEXT=

  • CTITLE=

  • FTITLE=

  • FTEXT=

  • HTEXT=

  • HTITLE=

If ODS NOUSEGOPT is in effect, the settings for these graphics options will not override the value in the style definition for titles and footnotes in your ODS output.

Examples
Example 1: Enabling and Disabling Graphics Options

ODS features:

  • ODS HTML statement:

    • FILE=

  • ODS LISTING statement:

    • CLOSE

  • ODS NOUSEGOPT statement

  • ODS USEGOPT statement

Other SAS features:

  • GOPTIONS statement:

    • FCTEXT=

    • FTITLE=

    • HTEXT=

  • PROC PRINT

  • TITLE statement

Data set:

  • sashelp.class

Program Description This example creates two HTML reports, one with the GOPTIONS enabled by using the ODS USEPGOT statement, and one with GOPTIONS disabled by using the ODS NOUSEGOPT statement.

Program

Specify the GOPTIONS. The RESET=ALL option sets all graphics options to their default values and cancels all global statements. The HTEXT= option specifies that the text height for titles and footnotes be two units. The FTITLE= option specifies the font for titles and footnotes. The FTEXT option specifies the font for the text.

goptions reset=all  htext=2 ftitle=script ftext=script; 

Do not produce listing output. The ODS LISTING statement closes the LISTING destination to conserve resources. Otherwise, output would be written to the LISTING destination by default.

ods listing close; 

Enable the graphics options. While ODS USEGOPT is in effect, the settings for HTEXT= and CTEXT= graphics options will override values that are specified for titles and footnotes in the style definition.

ods usegopt; 

Create HTML output, specify titles, and print the data set. The ODS HTML statement opens the HTML destination and creates HTML output. The output from PROC PRINT is sent to the body file specified by the FILE= option.

The TITLE statements specify the titles for your output.

The PRINT procedure prints the SAS data set from the SASHELP library. The OBS= option specifies two observations to be printed.

ods html file="opts.html";  title "This Title Was Created With the USEGOPT Option Specified ";  title2 "The Graphics Option Settings are Turned On";  proc print data=sashelp.class (obs=2);  run; 

Disable the graphics options. The NOUSEGOPT statement suppresses the use of the HTEXT= and CTEXT= graphics option settings for your output.

ods nousegopt; 

Create HTML output, specify titles, and print the data set. The ODS HTML statement opens the HTML destination and creates HTML output. The output from PROC PRINT is sent to the body file specified by the FILE= option.

The TITLE statements specify the titles for your output.

The PRINT procedure prints the SAS data set from the SASHELP library. The OBS= option specifies two observations to be printed.

title "This Title Was Created With the NOUSEGOPT Option Specified";  title2 "The Graphics Option Settings are Turned Off";  proc print data=sashelp.class (obs=2);  run; 

Close the HTML destination and open the LISTING destination. The ODS HTML CLOSE statement closes the HTML destination. To return ODS to its default setup, the ODS LISTING statement opens the LISTING destination.

ods html close;  ods listing; 

In the following example, the heights and fonts for the titles of the first table are specified by the FTITLE, FTEXT, and HTEXT options in the GOPTIONS statement. The heights and fonts for the titles of the second table are specified by the default style definition.

Click To expand
Display 5.17: HTML Output

ODS VERIFY Statement

Prints or suppresses a message indicating that a style definition or a table definition being used is not supplied by SAS

Valid: anywhere

Category: ODS: Output Control

Syntax

ODS VERIFY <ON | OFF | ERROR | WARN>;

Options

ON | OFF | ERROR | WARN

  • ON

    • prints the warning and sends output objects to open destinations.

    • Alias: ODS VERIFY

  • OFF

    • suppresses the warning.

    • Alias: ODS NOVERIFY

  • ERROR

    • prints an error message instead of a warning message and does not send output objects to open destinations.

  • WARN

    • prints a warning message and does not send output objects to open destinations.

  • Default: If you do not specify the ODS VERIFY statement, then ODS runs with the verification process turned off. If you specify the ODS VERIFY statement but do not specify an argument, then ODS runs with verification turned on.

  • Tip: For information about how to ignore user-created definitions, see ODS PATH Statement on page 149.

Details

Why Use the ODS VERIFY Statement? PROC TEMPLATE can modify the values in an output object. None of the definitions that SAS provides modifies any values. If you receive a warning from the ODS VERIFY statement, then look at the source code to verify that the values have not been modified.

ODS WML Statement

Opens, manages, or closes the WML destination, which uses the Wireless Application Protocol ( WAP ) to produce a Wireless Markup Language (WML) DTD with a simple list for a table of contents

Valid: anywhere

Category: ODS: Third-Party Formatted

Syntax

ODS WML < (<ID=> identifier )> action ;

ODS WML < (<ID=> identifier )> < file-specification(s) >< option(s) >< option(s) >;

Options

For a complete list of options, see the ODS MARKUP Statement on page 109.

Details

The ODS WML statement is part of the ODS markup family of statements. ODS statements in the markup family produce output that is formatted using one of many different markup languages, such as HTML (Hypertext Markup Language), XML (Extensible Markup Language), and LaTeX. You can specify a markup language that SAS supplies, or create one of your own and store it as a user-defined markup language.

[*] Draper, N. and Smith, H. (1998), Applied Regression Analysis, Second Edition , New York: John Wiley& Sons.




SAS 9.1 Output Delivery System. Users Guide
SAS 9.1 Output Delivery System Users Guide
ISBN: 1590472187
EAN: 2147483647
Year: 2004
Pages: 99
Authors: SAS Institute

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net