Chapter Contents


SAS Companion for the Microsoft Windows Environment

Automatic Macro Variables

The following automatic macro variables have values that are specific to Windows:

contains the current SAS condition code that SAS returns to Windows when the SAS System exits. Upon exit, SAS translates this condition code to a return code that has a meaningful value for the operating system.

gives the name of the current graphics device. The current graphics device is determined by the DEVICE system option. Contact your SAS Support Consultant to determine which graphics devices are available at your site. For information about the DEVICE system option, see DEVICE and SAS Language Reference: Dictionary.

always contains the value FORE under Windows.

returns a number that uniquely identifies the SAS task under Windows.

Operating Environment Information for Windows 95 Users:   When using SYSJOBID under Windows 95, you may receive an overflow error message if SYSJOBID is used in a conditional statement.   [cautionend]

returns the maximum long integer value allowed under Windows, which is 2,147,483,647.

holds the Windows status of Windows commands performed during your SAS session. The variable holds a character string that is the text form of the decimal value of the Windows command status.

Note:   This macro variable is useful only with Windows NT. Windows 95 does not allow the SAS System to retrieve the status of the command, and always returns 0.  [cautionend]

For example, consider the following statements:

options noxwait;
x 'dirf'; /* Invalid Windows command */
%put This Windows status is &sysrc;
x 'dir'; /* Valid Windows command  */
%put The corrected Windows status is &sysrc;
The following lines are written to the SAS log:
This Windows status is 1
The corrected Windows status is 0

The OPTIONS statement turns the XWAIT option off so that the Windows command prompt window disappears automatically without your having to type EXIT to return to your SAS session. If you run this example with the XWAIT option on, it does not work because you get a value of 0 in both cases; 0 is the return code for the EXIT command. If NOXSYNC is on, the value of SYSRC is automatically 0.

returns the operating system abbreviation WIN.

returns the name of the specific Windows environment you are using. For Version 8 under Windows, the possible return values are

Windows 95

Windows 98

Windows NT Workstation

Windows NT Server or Windows NT Advanced Server

Chapter Contents



Top of Page

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