BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ScottJP
Obsidian | Level 7

Hello - Can someone just advise me if this should work and if I'm just not doing something correctly please? 

 

I have a load of SAS scripts that are joined together in a process flow. There about 35 scripts.

 

I just want it to stop executing the flow (so subsequent steps) if an error occurs. 

 

I've put the below at the start, and thought this would do the trick:

 

options errorabend;
options ERRORCHECK=STRICT;
run;

 

I've done this on a test flow, which is just three scripts - First script designed to generate an error, and the subsequent scripts would just put a word in the log. If the options errorabend stuff is in the first script and I run the flow, the flow stops after it finds the error in the first script. (This is what I want). If I comment out the options errorabend stuff, the flow exectutes the remaining scripts (not what I want). 

 

I thought this would be fine, but when implemented into my real flow, the flow still runs the subsequent scripts! Even though, in the log, it says "SAS has ended due to error". 

 

Is this the right way to just get my flow to STOP as soon as an error is encoutered? That's all I want it to do.. I am using EG 7.12 - I know if 7.13 there will be an option in the properties for a script to do what I want, but I haven't got it yet. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Set a macro variable and use it in a condition attached to the following node(s). When EG loses connection to the workspace server (a consequence of the errorabend option), it simply starts a new WS when requested to execute a node. So you need to keep the node from executing, and that's what the conditions are for.

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

Set a macro variable and use it in a condition attached to the following node(s). When EG loses connection to the workspace server (a consequence of the errorabend option), it simply starts a new WS when requested to execute a node. So you need to keep the node from executing, and that's what the conditions are for.

ScottJP
Obsidian | Level 7

Ok thanks. I've just realised that 7.15 is ready to download, so I'm going to update to that instead so that I have the project properties option to stop current branch on errors. 

 

Cheers

karan124
Calcite | Level 5

Use &syserr or &syscc (but you will need to reset it).

 

%Macro Chec_Error;

%let syscc = 0;

 

run;

quit;

 

%if &syserr > 0 or &syscc > 0 %then

%do;

 

%put NOTE - "SYSERR - &syserr and SYSCC - &syscc ";

%put NOTE - "Error Reason - &syserrortext";

 

%abort cancel;

%end;

 

%mend;

 

Use the macro at the end of the code boundary.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 4325 views
  • 1 like
  • 3 in conversation