Previous Page | Next Page

SAS Macro Facility under Windows

Automatic Macro Variables

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

SYSCC

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

Note:   When ERRORCHECK=NORMAL, the return code will be 0 even if an error exists in a LIBNAME or FILENAME statement, or in a LOCK statement in SAS/SHARE software. Also, the SAS job or session will not end when the %INCLUDE statement fails due to a nonexistent file. For more information, see the ERRORCHECK= system option in the SAS Language Reference: Dictionary  [cautionend]

SYSDEVIC

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

SYSENV

always contains the value FORE under Windows.

SYSJOBID

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

SYSMAXLONG

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

SYSRC

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

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 1

The OPTIONS statement turns the XWAIT option off so that the Windows command prompt window closes automatically. You do not have to type exit to return to your SAS session. The value of "This Windows status is" will be 1, and the value for "The corrected Windows status is" will be 1. If you run this example with the XWAIT option, you would need to type exit before SAS would run the code. After you type exit, a value of 9009 is returned for the statement "This Windows status is", and 0 is the value for "The corrected Windows status is". If you use the NOXSYNC system option, the value of SYSRC is automatically 0.

SYSSCP

returns the operating environment abbreviation WIN.

SYSSCPL

returns the name of the specific Windows environment that you are using. The possible return values are

NET_ASRV

Microsoft Windows Server 2003 Enterprise Edition

NET_DSRV

Microsoft Windows Server 2003 Datacenter Edition

NET_SRV

Microsoft Windows Server 2003 Standard Edition

W32_DSRV08

Microsoft Windows 2008 Datacenter Server

W32_ESRV08

Microsoft Windows 2008 Enterprise Server

W32_SRV08

Microsoft Windows Server 2008

W32_VSPRO

Microsoft Windows Vista or Windows 7

X64_VSPRO

Microsoft Windows Vista x64 or Windows 7 x64

W64_ASRV

Microsoft Windows Server 2003 Enterprise 64-bit Edition for Itanium-based computers

W64_DSRV

Microsoft Windows Server 2003 Datacenter 64-bit Edition for Itanium-based computers

W64_DSRV08

Microsoft Windows Server 2008 Datacenter 64-bit edition for Itanium-based computers

W64_ESRV08

Microsoft Windows Server 2008 Enterprise 64-bit edition for Itanium-based computers

W64_SRV08

Microsoft Windows Server 2008 Standard 64-bit edition for Itanium-based computers

X64_DSRV

Microsoft Windows Server 2003 Datacenter 64-bit edition for x64 based computers

X64_ESRV

Microsoft Windows Server 2003 Enterprise 64-bit edition for x64 based computers

X64_SRV

Microsoft Windows Server 2003 Standard 64-bit edition for x64 based computers

X64_DSRV08

Microsoft Windows Server 2008 Datacenter 64-bit edition for x64-based computers

X64_ESRV08

Microsoft Windows Server 2008 Enterprise 64-bit edition for x64-based computers

X64_PRO

Microsoft Windows XP Professional x64 edition

X64_SRV08

Microsoft Windows Server 2008 Standard 64-bit edition for x64-based computers

XP_PRO

Microsoft Windows XP Professional

Previous Page | Next Page | Top of Page