1

I tried putting this before all programs (using the option to include code in pre-processing):

OPTIONS ERRORABEND;

It does trigger a warning popup but the next files do get executed. For example:

A -­> B -> C -> D

If A has an error, I will get a popup saying that an error occured and that the server has disconnected, however, B, C, and D will also run. I want the project execution to stop at A.

I have several old projects with tens if not hundreds of programs and therefore I don't consider using a macro (Is there a way to make SAS stop upon the first warning or error?) while also checking for errors as an option.

What can be done?

Thank you!

Edit: This is for SAS Entreprise Guide 7.1

Community
  • 1
  • 1
rockamic
  • 151
  • 1
  • 2
  • 11
  • This seems relevant: https://communities.sas.com/message/176661 – Haikuo Bian Jul 08 '15 at 20:07
  • Thanks for the link. I had already seen the site and got inspired by FrederikE's reponse (options ERRORABEND). As mentionned, it does not work as I would like. Also, they suggest macros but as mentionned above, macros (and conditional flows), are not much of an option. Ideally for me, ENDSAS would get called as soon as an error occurs. – rockamic Jul 08 '15 at 20:16
  • How are you executing your series of programs? – user667489 Jul 08 '15 at 20:40
  • Is this in enterprise guide, by chance? – Joe Jul 08 '15 at 21:38
  • Yes! Sorry, I should have mentionned it, silly me. I will add it to the main post. – rockamic Jul 09 '15 at 13:41

1 Answers1

0

I think the best way is to write in Macro, like:

%Macro error_check;
   'your process for A';
   %if &syserr > 0 %then %do;
        %goto exit;  
   %end; /* if your systemerror value is greater than zero, then go to exit directly */
    'your process for B';
    'your process for C';
    'your process for D';
%exit:  /* be careful, it is not semicolon*/
%Mend;

Just try NOT to put that %if &syserr loop inside a "data-run statement". I tried to do that and things got just complicated.

user3714330
  • 679
  • 12
  • 32