SYSENV Automatic Macro Variable
Reports whether SAS is running interactively.
Type: Automatic macro variable (read only)
Default: BACK
See: “Automatic Macro Variables in UNIX Environments” in SAS Companion for UNIX
Environments
“Automatic Macro Variables” in SAS Companion for Windows
“Macro Variables” in SAS Companion for z/OS
Details
The value of SYSENV is independent of the source of input. The following are values
for SYSENV:
FORE
when the SAS system option TERMINAL is in effect. For example, the value is
FORE when you run SAS interactively through a windowing environment.
BACK
when the SAS system option NOTERMINAL is in effect. For example, the value is
BACK when you submit a SAS job in batch mode.
You can use SYSENV to check the execution mode before submitting code that requires
interactive processing. To use a %INPUT statement, the value of SYSENV must be
FORE. For more information, see the SAS documentation for your operating
environment.
Operating Environment Information
Some operating environments do not support the submission of jobs in batch mode.
In this case the value of SYSENV is always FORE. For more information, see the
SAS documentation for your operating environment.
SYSERR Automatic Macro Variable
Contains a return code status set by some SAS procedures and the DATA step.
Type: Automatic macro variable (read only)
Details
You can use the value of SYSERR as a condition to determine further action to take or to
decide which parts of a SAS program to execute. SYSERR is used to detect major
system errors, such as out of memory or failure of the component system when used in
some procedures and DATA steps. SYSERR automatic macro variable is reset at each
step boundary. For the return code of a complete job, see “SYSCC Automatic Macro
Variable” on page 199.
SYSERR can contain the following values:
208 Chapter 14 Automatic Macro Variables
Table 14.3 SYSERR Values
Value Description
0 Execution completed successfully and without warning messages.
1 Execution was canceled by a user with a RUN CANCEL statement.
2 Execution was canceled by a user with an ATTN or BREAK command.
3 An error in a program run in batch or non-interactive mode caused SAS to
enter syntax-check mode.
4 Execution completed successfully but with warning messages.
5 Execution was canceled by a user with an ABORT CANCEL statement.
6 Execution was canceled by a user with an ABORT CANCEL FILE
statement.
>6 An error occurred. The value returned is procedure-dependent.
The following table contains warning return codes. The codes do not indicate any
specific problems. These codes are guidelines to identify the nature of a problem.
Table 14.4 SYSERR Warning Codes
Warning Code Description
108 Problem with one or more BY groups
112 Error with one or more BY groups
116 Memory problems with one or more BY groups
120 I/O problems with one or more BY groups
The following table contains error return codes. The codes do not indicate any specific
problems. These codes are guidelines to identify the nature of a problem.
Table 14.5 SYSERR Error Codes
Error Code Description
1008 General data problem
1012 General error condition
1016 Out-of-memory condition
1020 I/O problem
SYSERR Automatic Macro Variable 209
Error Code Description
2000 Semantic action problem
2001 Attribute processing problem
3000 Syntax error
4000 Not a valid procedure
9999 Bug in the procedure
20000 A step was stopped or an ABORT statement was issued.
20001 An ABORT RETURN statement was issued.
20002 An ABORT ABEND statement was issued.
25000 Severe system error. The system cannot initialize or continue.
Example: Using SYSERR
The example creates an error message and uses %PUT &SYSERR to write the return
code number (1012) to the SAS log.
data NULL;
set doesnotexist;
run;
%put &syserr;
The following SAS log output contains the return code number:
2
3 data NULL;
4 set doesnotexist;
ERROR: File WORK.DOESNOTEXIST.DATA does not exist.
5 run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.NULL may be incomplete. When this step was stopped
there were 0 observations and 0 variables.
NOTE: DATA statement used (Total process time):
real time 1:03.70
cpu time 0.07 seconds
6 %put &=syserr;
SYSERR=1012
To retrieve error and warning text instead of the return code number, see
“SYSERRORTEXT Automatic Macro Variable” on page 211 and
“SYSWARNINGTEXT Automatic Macro Variable” on page 234.
210 Chapter 14 Automatic Macro Variables
SYSERRORTEXT Automatic Macro Variable
Contains the text of the last error message formatted for display in the SAS log.
Type: Automatic macro variable (read only)
Details
The value of SYSERRORTEXT is the text of the last error message generated in the
SAS log. For a list of SYSERR warnings and errors, see “SYSERR Automatic Macro
Variable” on page 208.
Note: If the last error message text that was generated contains an & or % and you are
using the %PUT statement, you must use the %SUPERQ macro quoting function to
mask the special characters to prevent further resolution of the value. The following
example uses the %PUT statement and the %SUPERQ macro quoting function:
%put %superq(syserrortext);
For more information, see “%SUPERQ Function” on page 277.
Example: Using SYSERRORTEXT
This example creates an error message:
data NULL;
set doesnotexist;
run;
%put &syserrortext;
When these statements are executed, the following record is written to the SAS log:
1 data NULL;
2 set doesnotexist;
ERROR: File WORK.DOESNOTEXIST.DATA does not exist.
3 run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.NULL might be incomplete. When this step was
stopped there were 0 observations and 0 variables.
NOTE: DATA statement used (Total process time):
real time 11.16 seconds
cpu time 0.07 seconds
4 %put &syserrortext;
File WORK.DOESNOTEXIST.DATA does not exist.
SYSFILRC Automatic Macro Variable
Contains the return code from the last FILENAME statement.
Type: Automatic macro variable (read and write)
SYSFILRC Automatic Macro Variable 211
Details
SYSFILRC checks whether the file or storage location referenced by the last
FILENAME statement exists. You can use SYSFILRC to confirm that a file or location
is allocated before attempting to access an external file.
The following are values for SYSFILRC:
Table 14.6 SYSFILRC Values and Descriptions
Value Description
0 The last FILENAME statement executed correctly.
≠0 The last FILENAME statement did not execute correctly.
SYSHOSTINFOLONG Automatic Macro Variable
Contains the operating environment information that is displayed when the HOSTINFOLONG option is
specified.
Type: Automatic macro variable (read-only)
Details
Contains the operating environment information that is displayed when the
HOSTINFOLONG option is specified. For more information, see “HOSTINFOLONG
System Option” in SAS System Options: Reference.
SYSHOSTNAME Automatic Macro Variable
Contains the host name of the computer that is running the SAS process.
Type: Automatic macro variable (read only)
Details
SYSHOSTNAME contains the host name of the system that is running a single TCPIP
stack. If you are running multiple TCPIP stacks, use the SYSTCPIPHOSTNAME
automatic macro variable. For more information about TCPIP stacks, see your SAS host
companion documentation.
See Also
“SYSTCPIPHOSTNAME Automatic Macro Variable” on page 229
SYSINCLUDEFILEDEVICE Automatic Macro Variable
Contains the device type of the current %INCLUDE file.
212 Chapter 14 Automatic Macro Variables
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset