Two tools have been created to make error checking easier when you use the MODIFY
statement or the SET statement with the KEY= option to process SAS data sets:
• _IORC_ automatic variable
• SYSRC autocall macro
_IORC_ is created automatically when you use the MODIFY statement or the SET
statement with KEY=. The value of _IORC_ is a numeric return code that indicates the
status of the I/O operation from the most recently executed MODIFY or SET statement
with KEY=. Checking the value of this variable enables you to detect abnormal I/O
conditions and to direct execution down specific code paths instead of having the
application terminate abnormally. For example, if the KEY= variable value does match
between two observations, you might want to combine them and output an observation.
If they do not match, however, you might want to only write a note to the log.
Because the values of the _IORC_ automatic variable are internal and subject to change,
the SYSRC macro was created to enable you to test for specific I/O conditions while
protecting your code from future changes in _IORC_ values. When you use SYSRC, you
can check the value of _IORC_ by specifying one of the mnemonics listed in the
Table 21.4 Most Common Mnemonic Values of _IORC_ for DATA Step Processing
Mnemonic Value Meaning of Return Code When Return Code Occurs
_DSENMR The Transaction data set
observation does not exist in the
Master data set.
MODIFY with BY is used and no
_DSEMTR Multiple Transaction data set
observations with the same BY
variable value do not exist in the
Master data set.
MODIFY with BY is used and
consecutive observations with the
same BY values do not find a
match in the first data set. In this
situation, the first observation that
fails to find a match returns
_DSENMR. The subsequent
observations return _DSEMTR.
_DSENOM No matching observation was
found in the Master data set.
SET or MODIFY with KEY=
finds no match.
_SENOCHN The output operation was
the KEY= option in a MODIFY
statement contains duplicate
_SOK The I/O operation was successful. a match is found.
508 Chapter 21 • Reading, Combining, and Modifying SAS Data Sets