08-06-2013 09:28 AM
Is there an automatic way to make SAS stop upon the first error?
The other way is using for each node conditional processing, and for each node check macro variables SYSERR, but if you have an EG program with a lot of nodes ….. this mean rewrite all !!!
Thanks in advance
08-06-2013 03:28 PM
ENDSAS isn't a good idea in EG -- it terminates your SAS session and you'll lose anything in WORK, and you might not get all of your log content (with the errors). It's like hanging up the phone before you get any answers.
Other than conditional nodes (which you mentioned), there isn't currently a good approach to "abandon" a process flow upon the first error.
08-06-2013 03:48 PM
Well, you don't really define what it means to "make SAS stop", so here's one thought that involves a smaller amount of rewrite. You would have to replace all your RUN; statements with a macro call: %RUNN
Then macro could look like this:
%if &syserr > 0 %then %let _cancel_ = cancel;
It's based upon the idea that this statement does not run the DATA or PROC step:
However, it will still fill up your log, reflecting the steps that were canceled.
If you want to debug your process, then re-run it, you would have to add this statement up front:
It's a little unwieldy for EG, since you have to work with the EG-generated code to locate the RUN; statements, and you might even need additional functionality for the QUIT; statements.
08-06-2013 04:26 PM
While it wont stop on the first error the SAS option SYNTAXCHECK will force SAS into syntax check mode which means it will run the rest of the process steps only checking code and not doing any processing.
In EG this has to be set at the top of each code/process submission because EG switches it back to NOSYNTAXCHECK at the start of the next RUN.
08-06-2013 05:13 PM
When you are used to program in the DMS / Base environment ...and have a lot of nodes in one long manual sas-code.
The Eguide approach is a little bit different. You have your job-flow approach to segregate the process it in logical (smaller) steps.
Advice: Split up you old code in smaller logical parts.
This will make restarting en reviewing much more easier and you have solved the "stop at error" request, all is part of the job-flow approach.
Normally a dependant (flow) source will not run when the first source generated errors.
A lot more is possible: http://support.sas.com/resources/papers/proceedings09/320-2009.pdf
To Run or Not to Run: Apply Conditions to Your Tasks
08-09-2013 03:26 AM
Add Options errorabend; as the first step in your project. Either in prestep (Tools-Options-SAS programs-Custom code before...) or in a program object.
It will stop any execution immideately when an error occurs, but also close the connection to the SAS server, meaning all work data is lost!