Alex
Alex

Reputation: 355

SAS : How to ignore errors?

My SAS code contains multipledata steps and proc sql --> unrelated to one another . Some of them might throw an error . When this happens the rest of the code will terminate .

I need my code to keep on executing . Even if an error is thrown , just put it to the log ERROR : ... but still keep on executing . How can I do that ?

I tried some of the options from here

options noerrorabend;

But I could not find anything useful

Upvotes: 1

Views: 3828

Answers (2)

Robert Penridge
Robert Penridge

Reputation: 8513

Seems like a design problem.

Put each of your unrelated steps into different .sas files. If they're not related they shouldn't be in the same file anyway.

Call each .sas file individually from a UNIX script, or windows batch file, or SAS scheduler, or whatever it is you happen to be using.

If one of them has issues, it will not impact the next one in any way.

EDIT : Do NOT try to call them one after another by using a SAS %include statement, as this will use the same SAS session, and the problems from one will impact the next.

Upvotes: 1

Jeff
Jeff

Reputation: 1807

I'd be careful doing this in production, but it appears that you can get back into normal processing mode by putting this line after every one of your data steps and procs that are prone to error. It basically undoes the usual mode that SAS switches into when it encounters an error.

options obs=max nosyntaxcheck;

Upvotes: 5

Related Questions