Chapter Contents |
Previous |
Next |
%KEYDEF |
Type: | Macro statement |
Restriction: | Allowed in macro definitions or open code |
Syntax | |
Details | |
Example | |
Sample %KEYDEF Statements |
Syntax |
%KEYDEF key-name<definition>; |
The following examples illustrate using the %KEYDEF statement:
%keydef f1;
%keydef pf12;
%keydef 'SHF F6';
%keydef '^a';
Operating Environment Information: The names of function keys vary by operating environment and hardware. For details on the KEYS window, see the SAS documentation for your operating environment.
If the definition is not in quotation marks, any macro invocations or macro variables are resolved, and the definition is converted to uppercase. However, a definition that is not in quotation marks cannot contain semicolons unless they are enclosed in a macro quoting function. If the definition is more than 80 characters long, it is truncated to 80 characters without a warning or error message.
If the definition is enclosed in double quotation marks, macro references or macro variable references are resolved. If the resolved definition is more than 80 characters long, it is truncated to 80 characters without a warning or error message.
If the definition is enclosed in single quotation marks, macro references or macro variables are not resolved until the function key is pressed. To circumvent the 80 character limit on definition, you can use a macro invocation or macro variable reference.
The value of definition is
command | ~text
Details |
Use the %KEYDEF statement only in a SAS windowing environment session. Function key definitions you assign with %KEYDEF remain in effect for the duration of your current SAS session or until you change them again during the session. To save function key settings from one session to the next, use the KEYS window or place the %KEYDEF statement in an autoexec file.
Example |
In these examples the values f1 through f6 represent the names of function keys.
%keydef f1 %ckclear; /* assigns text generated by a macro to */ /* a function key (note no quotes) */
%keydef f1 "%ckclear"; /* assigns text generated by a macro to a */ /* function key (note the double quotes) */
%keydef f2 '%ckclear'; /* assigns a macro call to a function key */ /* (note the single quotes) */
%keydef f3 'pgm; submit "proc print data=hotdog; run;"';
%keydef f4 "%app"; /* Appends transaction file to master */
%keydef f5 '%printit'; /* Prints selected variables */'
%keydef f6 ~(obs=10); /* Add OBS=10 DATA set option */
%macro mykeys; %keydef f2 "clear log;clear output"; %keydef f4 rfind; %mend mykeys;
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.