![]() Chapter Contents |
![]() Previous |
![]() Next |
| WINDOW |
| Valid: | in a DATA step |
| Category: | Window Display |
| Type: | Declarative |
Syntax |
| WINDOW window <window-options> field-definition(s); |
| WINDOW window <window-options> group-definition(s); |
| Restriction: | Window names must conform to SAS naming conventions. |
| BLACK | MAGENTA |
| BLUE | ORANGE |
| BROWN | PINK |
| CYAN | RED |
| GRAY | WHITE |
| GREEN | YELLOW |
| Default: | The window fills all remaining columns in the display; the number of columns that are available depends on the type of monitor that is being used. |
| Default: | SAS displays the window at column 1. |
| Default: | SAS displays the window at row 1. |
| Default: | The window fills all remaining rows in the display. |
| Tip: | The number of rows that are available depends on the type of monitor that is being used. |
| Details |
Operating Environment Information:
You can use the WINDOW statement in the SAS windowing environment, in interactive line mode, or in noninteractive mode to create customized windows for your applications.(footnote 1) Windows that you create can display text and accept input; they have command and message lines. The window name appears at the top of the window. Use commands and function keys with windows that you create. A window definition remains in effect only for the DATA step that contains the WINDOW statement.
Define a window before you display it. Use the DISPLAY
statement to display windows that are created with the WINDOW statement. For
information about the DISPLAY statement, see
DISPLAY.
| <row column> variable <format> options |
The form for a character string is
| <row column> 'character-string' options |
The elements of a field definition are described here.
In a field definition, row can be one of these row pointer controls:
| Range: | n must be a positive integer. |
| Restriction: | #numeric-variable must be a positive integer. If the value is not an integer, the decimal portion is truncated and only the integer is used. |
| Restriction: | expression can contain array references and must evaluate to a positive integer. |
| Restriction: | Enclose expression in parentheses. |
In a field definition, column can be one of these column pointer controls:
| Restriction: | n must be a positive integer. |
| Restriction: | numeric-variable must be a positive integer. If the value is not an integer, the decimal portion is truncated and only the integer is used. |
| Restriction: | expression can contain array references and must evaluate to a positive integer. |
| Restriction: | Enclose expression in parentheses. |
| Range: | n must be a positive integer. |
| Restriction: | +numeric-variable must be a positive or negative integer. If the value is not an integer, the decimal portion is truncated and only the integer is used. |
| Restriction: | The character string must be enclosed in quotation marks. |
| Restriction: | You cannot enter a value in a field that contains a character string. |
| Alias: | A= |
| Tip: | To specify more than one highlighting attribute, use the form |
ATTR=(highlighting-attribute-1, . . . )
| Tip: | The highlighting attributes that are available depend on the type of monitor that you use. |
| YES | specifies that the cursor moves automatically to the next unprotected field. |
| NO | specifies that the cursor does not move automatically. |
| Alias: | AUTO= |
| Default: | NO |
| BLACK | MAGENTA |
| BLUE | ORANGE |
| BROWN | PINK |
| CYAN | RED |
| GRAY | WHITE |
| GREEN | YELLOW |
| Alias: | C= |
| Default: | WHITE |
| Tip: | The representation of colors may vary, depending on the monitor you use. |
| Tip: | COLOR= has no effect on monochrome monitors. |
| YES | specifies that SAS displays characters in a field as you type them in. | ||
| NO |
specifies that the entered characters are not displayed.
|
| Default: | NO |
| Tip: | PERSIST= is most useful when the position of a field changes in each execution of a DISPLAY statement. |
| Featured in: | Persisting and Nonpersisting Fields |
| YES | specifies that you cannot enter information. |
| NO | specifies that you can enter information. |
| Alias: | P= |
| Default: | No |
| Tip: | Use PROTECT= only for fields that contain variables; fields that contain text are automatically protected. |
| NO | specifies that you can leave the field blank. |
| YES | specifies that you must enter a value in the field. |
| Default: | NO |
| Tip: | If you try to leave a field blank that was defined with REQUIRED=YES, SAS does not allow you to input values in any subsequent fields in the window. |
The WINDOW statement creates two automatic SAS variables: _CMD_ and _MSG_.
A DATA step that contains a DISPLAY statement continues execution until
| Comparisons |
| Examples |
This DATA step creates a window with a single group of fields:
data _null_;
window start
#9 @26 'WELCOME TO THE SAS SYSTEM'
color=black
#12 @19 'THIS PROGRAM CREATES'
#12 @40 'TWO SAS DATA SETS'
#14 @26 'AND USES THREE PROCEDURES'
#18 @27 'Press ENTER to continue';
display start;
stop;
run;
The following statements assign news articles to reporters. The list of article topics is stored as variable art in SAS data set category.article. This application allows you to assign each topic to a writer and to view the accumulating assignments. The program creates a new SAS data set named Assignment.
libname category 'SAS-data-library';
data Assignment;
set category.article end=final;
drop a b j s o;
window Assignment irow=1 rows=12 color=white
#3 @10 'Article:' +1 art protect=yes
'Name:' +1 name $14.;
window Showtotal irow=20 rows=12 color=white
group=subtotal
#1 @10 'Adams has' +1 a
#2 @10 'Brown has' +1 b
#3 @10 'Johnson has' +1 j
#4 @10 'Smith has' +1 s
#5 @10 'Other has' +1 o
group=lastmessage
#8 @10
'ALL ARTICLES ASSIGNED.
Press ENTER to stop processing.';
display Assignment blank;
if name='Adams' then a+1;
else if name='Brown' then b+1;
else if name='Johnson' then j+1;
else if name='Smith' then s+1;
else o+1;
display Showtotal.subtotal blank noinput;
if final then display Showtotal.lastmessage;
run;
When you execute the DATA step, the following windows appear.
data _null_;
array row{3} r1-r3;
array col{3} c1-c3;
input row{*} col{*};
window One
rows=20 columns=36
#1 @14 'PERSIST=YES' color=black
#(row{i}) @(col{i}) 'Hello'
color=black persist=yes;
window Two
icolumn=43 rows=20 columns=36
#1 @14 'PERSIST=NO' color=black
#(row{i}) @(col{i}) 'Hello'
color=black persist=no;
do i=1 to 3;
display One;
display Two;
end;
datalines;
5 10 15 5 10 15
;
The following windows show the results of this DATA step after its
third
iteration.
Note
that window One shows
Hello in all three positions
in which it was displayed. Window Two shows only the third and final position
in which
Hello was displayed.
if _cmd_ ne ' ' then _msg_='CAUTION: UNRECOGNIZED COMMAND' || _cmd_;When you enter a command that contains an error, SAS sets the value of _CMD_ to the text of the erroneous command. Because the value of _CMD_ is no longer blank, the IF statement is true. The THEN statement assigns to _MSG_ the value that is created by concatenating CAUTION: UNRECOGNIZED COMMAND and the value of _CMD_ (up to a total of 80 characters). The next time a DISPLAY statement displays that window, the message line of the window displays
CAUTION: UNRECOGNIZED COMMAND commandCommand is the erroneous windowing command.
| See Also |
Statements:
| |||
| "The PMENU Procedure" in SAS Procedures Guide |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.