Thursday, April 16, 2009

What is _IORC_?

It is short for Input-Output Return code. The definition is at below from SAS online doc:
The automatic variable _IORC_ contains the return code for each I/O operation that the MODIFY statement attempts to perform.

However, it is not quite right. We should get some points for _IORC_:
#1: it is automatic variable, which means it exist in PDV but do not output.
#2: it used with indexed dataset to check whether the direct read found a matching obervation. That means it do make sense in dataset with key= option, no matter what statement is used, e.g. SET statement, MODIFY statement, etc.
#3: it is a good habit to always check _IORC_ after reading indexed dataset. Here is a good example: http://support.sas.com/kb/26/002.html.
#4: since SET statement retain all variable values, we should STOP or re-assign all variables to missing and _ERROR_ to 0 when _IORC_ is not _SOK (no matching observation).

No comments: