Previous Page | Next Page

The DOCUMENT Procedure

Customizing Labels, Titles, and Footnotes with BY Variables


You can customize labels, titles, and footnotes with these statements by inserting BY variable values (#BYVAL), BY variable names (#BYVAR), or BY lines (#BYLINE) in labels that are specified in the following PROC DOCUMENT statements:

OBANOTE Statement

OBBNOTE Statement

OBFOOTN Statement

OBSTITLE Statement

OBTITLE Statement

SETLABEL Statement

Note:   The #BYVAL, #BYVAR, and #BYLINE substitutions only show up for replayed output objects that belong to a BY group. Examples of output objects that do not belong to a BY group are data sets that are imported into a document with the IMPORT TO statement, and notes that are created with the NOTES statement.  [cautionend]

To create these substitutions, embed the items in the specified object text string at the position where you want the substitution text to appear. The #BYVAL, #BYVAR, and #BYLINE substitutions have this form:

#BYVALn | #BYVAL(variable-name)

substitutes the current value of the specified BY variable for #BYVAL in the text string and displays the value in the label.

Follow these rules when you use #BYVAL in a statement of a PROC DOCUMENT step:

  • Specify the variable that is used by #BYVAL in the BY statement.

  • Insert #BYVAL in the specified text string at the position where you want the substitution text to appear.

  • Follow #BYVAL with a delimiting character, either a space or other nonalphanumeric character (for example, a quotation mark) that ends the text string.

  • To immediately follow the #BYVAL substitution with other text and no delimiter, use a trailing dot (as with macro variables).

  • Specify the variable with one of the following:

    n

    specifies which variable in the BY statement that #BYVAL should use. The value of n indicates the position of the variable in the BY statement.

    Example: #BYVAL2 specifies the second variable in the BY statement.
    variable-name

    names the BY variable.

    Example: #BYVAL(YEAR) specifies the BY variable, YEAR.
    Tip: variable-name is not case sensitive.
    Requirement: You must enclose variable-name in parentheses.
#BYVARn | #BYVAR(variable-name)

substitutes the name of the BY variable or label that is associated with the variable (whatever the BY line would normally display) for #BYVAR in the text string and displays the name or label.

Follow these rules when you use #BYVAR in a statement of a PROC DOCUMENT step:

  • Specify the variable that is used by #BYVAR in the BY statement.

  • Insert #BYVAR in the specified text string at the position where you want the substitution text to appear.

  • Follow #BYVAR with a delimiting character, either a space or other nonalphanumeric character (for example, a quotation mark) that ends the text string.

  • To immediately follow the #BYVAR substitution with other text and no delimiter, use a trailing dot (as with macro variables).

  • Specify the variable with one of the following:

    n

    specifies the variable in the BY statement that #BYVAR should use. The value of n indicates the position of the variable in the BY statement.

    Example: #BYVAR2 specifies the second variable in the BY statement.
    variable-name

    names the BY variable.

    Example: #BYVAR(SITES) specifies the BY variable SITES.
    Tip: variable-name is not case sensitive.
    Requirement: You must enclose variable-name in parentheses.
#BYLINE

substitutes the entire BY line without leading or trailing blanks for #BYLINE in the text string and displays the BY line in the label.

Previous Page | Next Page | Top of Page