BookmarkSubscribeRSS Feed
prizzo60
Calcite | Level 5

Hi friends.

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

8 REPLIES 8
flysnow
Calcite | Level 5

how about ENDSAS

ChrisHemedinger
Community Manager

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.

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Fugue
Quartz | Level 8

What version of EG are you using? Beginning with EG 4.2, you can run a branch conditionally . . .

Astounding
PROC Star

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:

%macro RUNN;

   %global _cancel_;

   run &_cancel_;

   %if &syserr > 0 %then %let _cancel_ = cancel;

%mend RUNN;

It's based upon the idea that this statement does not run the DATA or PROC step:

run cancel;

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:

%let _cancel_=;

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.

Good luck.

SASKiwi
PROC Star

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.

jakarman
Barite | Level 11

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

---->-- ja karman --<-----
FredrikE
Rhodochrosite | Level 12

Hi!

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!

//Fredrik

agoldma
Pyrite | Level 9

See Casey Smith's reply in this thread:

https://communities.sas.com/t5/SAS-Enterprise-Guide/Making-EG-Stop-Executing-subsequent-process-flow...

Project Properties > Code Submission > Action to take on errors during execution

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 5901 views
  • 9 likes
  • 9 in conversation