%SYSRC Autocall Macro

Returns a value corresponding to an error condition.
Type: Autocall macro
Requirement: MAUTOSOURCE system option

Syntax

%SYSRC(character-string)

Required Argument

character-string
is one of the mnemonic values listed in Mnemonics for Warning and Error Conditions or a text expression that produces the mnemonic value.

Details

Note: Autocall macros are included in a library supplied by SAS. This library might not be installed at your site or might be a site-specific version. If you cannot access this macro or if you want to find out if it is a site-specific version, see your on-site SAS support personnel. For more information, see Storing and Reusing Macros.
The SYSRC macro enables you to test for return codes produced by SCL functions, the MODIFY statement, and the SET statement with the KEY= option. The SYSRC autocall macro tests for the error conditions by using mnemonic strings rather than the numeric values associated with the error conditions.
When you invoke the SYSRC macro with a mnemonic string, the macro generates a SAS return code. The mnemonics are easier to read than the numeric values, which are not intuitive and subject to change.
You can test for specific errors in SCL functions by comparing the value returned by the function with the value returned by the SYSRC macro with the corresponding mnemonic. To test for errors in the most recent MODIFY or SET statement with the KEY= option, compare the value of the _IORC_ automatic variable with the value returned by the SYSRC macro when you invoke it with the value of the appropriate mnemonic.
The following table lists the mnemonic values to specify with the SYSRC function and a description of the corresponding error.
Mnemonics for Warning and Error Conditions
Mnemonic
Description
Library Assign or Deassign Messages
_SEDUPLB
The libref refers to the same physical library as another libref.
_SEIBASN
The specified libref is not assigned.
_SEINUSE
The library or member is not available for use.
_SEINVLB
The library is not in a valid format for the access method.
_SEINVLN
The libref is not valid.
_SELBACC
The action requested cannot be performed because you do not have the required access level on the library.
_SELBUSE
The library is still in use.
_SELGASN
The specified libref is not assigned.
_SENOASN
The libref is not assigned.
_SENOLNM
The libref is not available for use.
_SESEQLB
The library is in sequential (tape) format.
_SWDUPLB
The libref refers to the same physical file as another libref.
_SWNOLIB
The library does not exist.
Fileref Messages
_SELOGNM
The fileref is assigned to an invalid file.
_SWLNASN
The fileref is not assigned.
SAS Data Set Messages
_DSENMR
The TRANSACTION data set observation does not exist in the MASTER data set.
_DSEMTR
Multiple TRANSACTION data set observations do not exist in MASTER data set.
_DSENOM
No matching observation was found in MASTER data set.
_SEBAUTH
The data set has passwords.
_SEBDIND
The index name is not a valid SAS name.
_SEDSMOD
The data set is not open in the correct mode for the specified operation.
_SEDTLEN
The data length is invalid.
_SEINDCF
The new name conflicts with an index name.
_SEINVMD
The open mode is invalid.
_SEINVPN
The physical name is invalid.
_SEMBACC
You do not have the level of access required to open the data set in the requested mode.
_SENOLCK
A record-level lock is not available.
_SENOMAC
Member-level access to the data set is denied.
_SENOSAS
The file is not a SAS data set.
_SEVARCF
The new name conflicts with an existing variable name.
_SWBOF
You tried to read the previous observation when you were on the first observation.
_SWNOWHR
The record no longer satisfies the WHERE clause.
_SWSEQ
The task requires reading observations in a random order, but the engine that you are using allows only sequential access.
_SWWAUG
The WHERE clause has been augmented.
_SWWCLR
The WHERE clause has been cleared.
_SWWREP
The WHERE clause has been replaced.
SAS File Open and Update Messages
_SEBDSNM
The filename is not a valid SAS name.
_SEDLREC
The record has been deleted from the file.
_SEFOPEN
The file is currently open.
_SEINVON
The option name is invalid.
_SEINVOV
The option value is invalid.
_SEINVPS
The value of the File Data Buffer pointer is invalid.
_SELOCK
The file is locked by another user.
_SENOACC
You do not have the level of access required to open the file in the requested mode.
_SENOALL
_ALL_ is not allowed as part of a filename in this release.
_SENOCHN
The record was not changed because it would cause a duplicate value for an index that does not allow duplicates.
_SENODEL
Records cannot be deleted from this file.
_SENODLT
The file could not be deleted.
_SENOERT
The file is not open for writing.
_SENOOAC
You are not authorized for the requested open mode.
_SENOOPN
The file or directory is not open.
_SENOPF
The physical file does not exist.
_SENORD
The file is not opened for reading.
_SENORDX
The file is not radix addressable.
_SENOTRD
No record has been read from the file yet.
_SENOUPD
The file cannot be opened for update because the engine is read only.
_SENOWRT
You do not have write access to the member.
_SEOBJLK
The file or directory is in exclusive use by another user.
_SERECRD
No records have been read from the input file.
_SWACMEM
Access to the directory will be provided one member at a time.
_SWDLREC
The record has been deleted from file.
_SWEOF
End of file.
_SWNOFLE
The file does not exist.
_SWNOPF
The file or directory does not exist.
_SWNOREP
The file was not replaced because of the NOREPLACE option.
_SWNOTFL
The item pointed to exists but is not a file.
_SWNOUPD
This record cannot be updated at this time.
Library/Member/Entry Messages
_SEBDMT
The member type specification is invalid.
_SEDLT
The member was not deleted.
_SELKUSR
The library or library member is locked by another user.
_SEMLEN
The member name is too long for this system.
_SENOLKH
The library or library member is not currently locked.
_SENOMEM
The member does not exist.
_SWKNXL
You have locked a library, member, or entry, that does not exist yet.
_SWLKUSR
The library or library member is locked by another user.
_SWLKYOU
You have already locked the library or library member.
_SWNOLKH
The library or library member is not currently locked.
Miscellaneous Operations
_SEDEVOF
The device is offline or unavailable.
_SEDSKFL
The disk or tape is full.
_SEINVDV
The device type is invalid.
_SENORNG
There is no write ring in the tape opened for write access.
_SOK
The function was successful.
_SWINVCC
The carriage-control character is invalid.
_SWNODSK
The device is not a disk.
_SWPAUAC
Pause in I/O, process accumulated data up to this point.
_SWPAUSL
Pause in I/O, slide data window forward and process accumulated data up to this point.
_SWPAUU1
Pause in I/O, extra user control point 1.
_SWPAUU2
Pause in I/O, extra user control point 2.

Comparisons

The SYSRC autocall macro and the SYSRC automatic macro variable are not the same. For more information, see SYSRC Automatic Macro Variable.

Example: Examining the Value of _IORC_

The following DATA step illustrates using the autocall macro SYSRC and the automatic variable _IORC_ to control writing a message to the SAS log:
data big;
   modify big trans;
   by id;
   if _iorc_=%sysrc(_dsenmr) then put 'WARNING: Check ID=' id;
run;