Chapter Contents

Previous

Next
SAS Companion for the Microsoft Windows Environment

Macro Statements

The following macro statements have behavior specific to Windows:

%KEYDEF
enables you to define function keys. It is analogous to the KEYDEF display manager command. The %KEYDEF statement has the following syntax:

%KEYDEF key-name | 'key-name' <'definition'>;

If the definition argument is omitted, a message is printed to the log showing the current definition of the key; otherwise, the key's definition is changed to whatever you specify.

Key names might vary depending on your workstation. You can define any key listed in the KEYS window, provided it is not reserved by Windows. You must enclose in quotes any key name that is hyphenated or contains a space, such as SHF F2 or CTRL Z.

You can also use the %KEYDEF statement to define commands that are executed when the mouse buttons are pressed. The following key sequences are accepted as the key-name argument:

Key Name Key Sequence
RMB right mouse button
SHF RMB SHIFT key, right mouse button
CTL RMB CONTROL key, right mouse button
MMB middle mouse button
SHF MMB SHIFT key, middle mouse button
CTL RMB CONTROL key, right mouse button

For example, to assign the ZOOM command to the CTL RMB key sequence, submit the following command:

%keydef 'ctl rmb' 'zoom';

%SYSEXEC
executes operating system commands immediately and places the return code in the SYSRC automatic macro variable. The %SYSEXEC statement is similar to the X statement described in Running DOS or Windows Commands from within SAS. You can use the %SYSEXEC statement inside a macro or in open code. The %SYSEXEC statement has the following syntax:

%SYSEXEC <command>;

The command argument can be any operating system command or any sequence of macro operations that generate an operating system command. You can also use the command argument to invoke a Windows application such as Notepad.

Omitting the command argument launches a command prompt subprocess, which is interactive. To return to your SAS session, type EXIT at the command prompt and press ENTER. The SYSRC automatic variable is set to 0 if you omit the command argument in the %SYSEXEC statement.

Here is a simple example of %SYSEXEC:

%sysexec time;

This statement launches a command prompt session that displays the following lines:

The current time is: 16:32:45.16
Enter new time:

Note:   The %SYSEXEC statement uses the XSYNC and XWAIT system option values just like the X statement and X command do. For more information about these system options, see XSYNC System Option and XWAIT System Option.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.