Chapter Contents


SAS Companion for the OS/2 Environment

Macro Statements

The following macro statements have behavior specific to OS/2:

is analogous to the KEYDEF display manager command. It enables you to define function keys. 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 OS/2. You must enclose in quotes any key name that contains a special character 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+right mouse button
CTL RMB CTRL+right mouse button
MMB middle mouse button
SHF MMB SHIFT+middle mouse button
CTL RMB CTRL+right mouse button

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

%keydef 'ctl rmb' 'zoom';

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 Issuing OS/2 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 OS/2 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. If you omit the command argument in the %SYSEXEC statement, the SYSRC automatic variable is set to 0.

The following 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



Top of Page

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