08-22-2013 10:29 AM
Is it possible in any case that sas can write out recrds to ouput dataset even with errors (any kind of errors) in the log.
I'm thinking of checking errors by looking at obs > 0 in the final data set. Is there any potential issues with this?
08-22-2013 10:40 AM
Are you looking to send records with errors to a separate data set within a data step? It will depend on the types of 'error' encountered.
There is an automatic variable _ERROR_ in data vector that SAS will set to 1 for most error conditions. You can direct those records to a separate data set with code similar to :
Data NormalProcess Error;
if _error_= 1 then output Error;
else output NormalProcess;
08-22-2013 12:31 PM
There are two potential issues off the top of my head.
First, the logic of that final DATA step may output zero observations, even if there are no errors.
Second, what if the final DATA step replaces an existing data set? The final step might contain errors, yet the existing data set would not be replaced because of the errors. When you check for the number of observations, you will find that observations exist because they were already there before the error-filled DATA step began.
08-22-2013 01:33 PM
I you want to exclude the possibility of a program or executing error by checking the condition this way it is rather tricky.
- The last processing code need not to be something creating a dataset. Coud be a report processing
- Creating a dataset with 0 record can be the signal of a good processed flow when this dataset is the collection of error records
- When generating reports or flatfiles you are creating not sas-datasets but something else.
SAS has many ways to validate the processing. The macro sysrc serves as condition code to the OS.
Even that way of checking is not 99,9% reliable. Sometimes you do not get any feedback or it an bug in errorchecking.
Please can you explain your situation environment and what you are trying to achieve?.