field-definition
identifies and describes a macro variable or string that you want to display in the
window. A window can contain any number of fields.
You use a field to identify a macro variable value (or constant text) to be displayed,
its position within the window, and its attributes. Enclose constant text in quotation
marks. The position of a field is determined by beginning row and column. The
attributes that you can specify include color, whether you can enter a value into the
field, and characteristics such as highlighting.
The form of a field definition containing a macro variable is
<row> <column> macro-variable<field-length> <options>
The form of a field definition containing constant text is
<row> <column>'text' | “text”<options>
The elements of a field definition are
row
specifies the row (line) on which the macro variable or constant text is displayed.
Each row specification consists of a pointer control and, usually, a macro
expression that generates a number. These row pointer controls are available:
#macro-expression
specifies the row within the window given by the value of the macro
expression. The macro expression must either be a positive integer or
generate a positive integer.
/ (forward slash)
moves the pointer to column 1 of the next line.
The macro processor evaluates the macro expression when it defines the window,
not when it displays the window. Thus, the row position of a field is fixed when
the field is being displayed.
If you omit row in the first field of a group, the macro processor uses the first line
of the window. If you omit row in a later field specification, the macro processor
continues on the line from the previous field.
The macro processor treats the first usable line of the window as row 1 (that is, it
excludes the border, command line or menu bar, and message line).
Specify either row or column first.
column
specifies the column in which the macro variable or constant text begins. Each
column specification consists of a pointer control and, usually, a macro
expression that generates a number. These column pointer controls are available:
@macro-expression
specifies the column within the window given by the value of the macro
expression. The macro expression must either be a positive integer or
generate a positive integer.
+macro-expression
moves the pointer the number of columns given by the value of the macro
expression. The macro expression must either be a positive integer or
generate a positive integer.
The macro processor evaluates the macro expression when it defines the window,
not when it displays the window. Thus, the column position of a field is fixed
when the field is being displayed.
%WINDOW Statement 347
The macro processor treats the column after the left border as column 1. If you
omit column, the macro processor uses column 1.
Specify either column or row first.
macro-variable
names a macro variable to be displayed or to receive the value that you enter at
that position. The macro variable must either be a macro variable name (not a
macro variable reference) or it must be a macro expression that generates a
macro variable name.
By default, you can enter or change a macro variable value when the window
containing the value is displayed. To display the value without changes, use the
PROTECT= option.
CAUTION:
Do not overlap fields. Do not let a field overlap another field displayed at
the same time. Unexpected results, including the incorrect assignment of
values to macro variables, might occur. (Some display devices treat adjacent
fields with no intervening blanks as overlapping fields.) SAS writes a
warning in the SAS log if fields overlap.
field-length
is an integer specifying how many positions in the current row are available for
displaying the macro variable's value or for accepting input. The maximum value
of field-length is the number of positions remaining in the row. You cannot
extend a field beyond one row.
Note: The field length does not affect the length stored for the macro variable.
The field length affects only the number of characters displayed or accepted
for input in a particular field.
If you omit field-length when the field contains an existing macro variable, the
macro processor uses a field equal to the current length of the macro variable
value. This value can be up to the number of positions remaining in the row or
remaining until the next field begins.
CAUTION:
Specify a field length whenever a field contains a macro variable. If the
current value of the macro variable is null, as in a macro variable defined in a
%GLOBAL or %LOCAL statement, the macro processor uses a field length
of 0. You cannot input any characters into the field.
If you omit field-length when the macro variable is created in that field, the
macro processor uses a field length of zero. Specify a field length whenever a
field contains a macro variable.
'text' | “text”
contains constant text to be displayed. The text must be enclosed in either single
or double quotation marks. You cannot enter a value into a field containing
constant text.
options
can include the following:
ATTR=attribute | (attribute-1 < , attribute-2 ...>) A=attribute | (attribute-1 <,
attribute-2 ...>)
controls several display attributes of the field. The display attributes and
combinations of display attributes available depend on the type of display
device that you use.
348 Chapter 19 Macro Statements
BLINK causes the field to blink.
HIGHLIGHT displays the field at high intensity.
REV_VIDEO displays the field in reverse video.
UNDERLINE underlines the field.
AUTOSKIP=YES | NO
AUTO=YES | NO
controls whether the cursor moves to the next unprotected field of the current
window or group when you have entered data in all positions of a field. If
you specify AUTOSKIP=YES, the cursor moves automatically to the next
unprotected field. If you specify AUTOSKIP=NO, the cursor does not move
automatically. The default is AUTOSKIP=YES.
COLOR=color C=color
specifies a color for the field. The default color is device-dependent. Color
can be one of these:
BLACK
BLUE
BROWN
CYAN
GRAY (or GREY)
GREEN
MAGENTA
ORANGE
PINK
WHITE
YELLOW
DISPLAY=YES | NO
determines whether the macro processor displays the characters that you are
entering into a macro variable value as you enter them. If you specify
DISPLAY=YES (the default value), the macro processor displays the
characters as you enter them. If you specify DISPLAY=NO, the macro
processor does not display the characters as you enter them.
DISPLAY=NO is useful for applications that require users to enter
confidential information, such as passwords. Use the DISPLAY= option only
with fields containing macro variables; constant text is displayed
automatically.
PROTECT=YES | NO
P=YES | NO
controls whether information can be entered into a field containing a macro
variable. If you specify PROTECT=NO (the default value), you can enter
information. If you specify PROTECT=YES, you cannot enter information
into a field. Use the PROTECT= option only for fields containing macro
variables; fields containing text are automatically protected.
REQUIRED=YES | NO
determines whether you must enter a value for the macro variable in that
field. If you specify REQUIRED=YES, you must enter a value into that field
in order to remove the display from the window. You cannot enter a null
value into a required field. If you specify REQUIRED=NO (the default
%WINDOW Statement 349
value), you do not have to enter a value in that field in order to remove the
display from the window. Entering a command on the command line of the
window removes the effect of REQUIRED=YES.
Details
Use the %WINDOW statement to define customized windows that are controlled by the
macro processor. These windows have command and message lines. You can use these
windows to display text and accept input. In addition, you can invoke windowing
environment commands, assign function keys, and use a menu generated by the PMENU
facility.
You must define a window before you can display it. The %WINDOW statement defines
macro windows; the %DISPLAY statement displays macro windows. Once defined, a
macro window exists until the end of the SAS session, and you can display a window or
redefine it at any point.
Defining a macro window within a macro definition causes the macro processor to
redefine the window each time the macro executes. If you repeatedly display a window
whose definition does not change, it is more efficient to do one of the following:
define the window outside a macro
define the window in a macro that you execute once rather than in the macro in
which you display it
If a %WINDOW statement contains the name of a new macro variable, the macro
processor creates that variable with the current scope. The %WINDOW statement
creates two automatic macro variables.
SYSCMD
contains the last command from the window's command line that was not recognized
by the windowing environment.
SYSMSG
contains text that you specify to be displayed on the message line.
Note: Windowing environment file management, scrolling, searching, and editing
commands are not available to macro windows.
Examples
Example 1: Creating an Application Welcome Window
This %WINDOW statement creates a window with a single group of fields:
%window welcome color=white
#5 @28 'Welcome to SAS.' attr=highlight
color=blue
#7 @15
"You are executing Release &sysver on &sysday, &sysdate.."
#12 @29 'Press ENTER to continue.';
The WELCOME window fills the entire display device. The window is white, the first
line of text is blue, and the other two lines are black at normal intensity. The
WELCOME window does not require you to input any values. However, you must press
Enter to remove the display from the window.
Note: Two periods are a needed delimiter for the reference to the macro variables
SYSVER, SYSDAY, and SYSDATE.
350 Chapter 19 Macro Statements
Example 2: Creating Macro Variables from Input Information
The following example prompts for information and creates macro variables from that
information:
%window info
#5 @5 'Please enter userid:'
#5 @26 id 8 attr=underline
#7 @5 'Please enter password:'
#7 @28 pass 8 attr=underline display=no;
%display info;
%put userid entered was &id;
%put password entered was &pass;
%WINDOW Statement 351
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset