Date: Fri, 25 Feb 2000 08:37:39 -0500
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: VALUE OF A VARIABEL IN A TITLE
Content-Type: text/plain; charset=US-ASCII
> IS THERE A WAY OF INSERTING A VARIABLE VALUE INSIDE A FIELD?
Earlier responses interpreted the question as referring to a macro variable.
Data set variables can also be made to materialize in titles, under certain conditions. The following is from V. 7 documentation, though the functionality has been there since 6.07 I believe:
Customizing Titles in a PROC step
You can customize titles by inserting BY variable values (#BYVALn), BY
variable names (#BYVARn), or BY lines (#BYLINE) in titles that are
specified in PROC steps. Embed the items in the specified title text string
at the position where you want the substitution text to appear.
#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 title.
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.
#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 in the
title. Specify the variable with one of the following:
n
specifies which 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.
#BYLINE
substitutes the entire BY line without leading or trailing blanks for
#BYLINE in the text string and displays the BY line in the title.
Tip:
#BYLINE produces output that contains a BY
line at the top of the page unless you suppress
it by using NOBYLINE in an OPTIONS
statement.
See Also:
For more information on NOBYLINE, see
BYLINE.
In a PROC step
Follow these rules when you use #BYVAR, #BYVAL, and #BYLINE in
the TITLE statement of a PROC step:
Specify the variable that is used by #BYVAR or #BYVAL in the
BY statement.
Insert #BYVAL and #BYVAR in the specified title text string at
the position where you want the substitution text to appear.
Follow #BYVAL and #BYVAR with a delimiting character, either
a space or other nonalphanumeric character (for example, a
quotation mark) that ends the text string.
If you want the #BYVAR or #BYVAL substitution to be followed
immediately by other text, with no delimiter, use a trailing dot (as
with macro variables).