_ERROR_ is not quite what you think it is. _ERROR_ does not indicate an error that causes the data step to terminate; that wouldn't be checkable except by exclusion (like Jaap suggests). IE, the moment a SAS data step finds an error that causes it to terminate, it terminates - it doesn't go to the bottom and see if it should do something about it. There's no TRY/CATCH in SAS. _ERROR_ indicates data errors, such as division by zero, invalid data provided to a PUT or INPUT, etc. See SAS(R) 9.2 Language Reference: Concepts, Second Edition for more details. PROC IMPORT for CSV, where you probably first saw this variable, uses this to identify issues with data formatting (such as if a numeric column contains character values). If you want to check for actual termination errors, then check &SYSERR, which will be 0 if the last data step worked or nonzero if it failed. See SAS(R) 9.2 Macro Language: Reference for more details and be aware it's not supported by all procs.
... View more