BookmarkSubscribeRSS Feed
SASdevAnneMarie
Rhodochrosite | Level 12

Hello experts,

I am running SAS code in SAS Enterprise Guide 8.3 using an Ordered List. I would like to know if there is an option to stop the execution when one of the programs encounters an error.

Thank you.

7 REPLIES 7
ChrisHemedinger
Community Manager

You should be able to add a Condition to the item in your process flow. The condition can be based on different criteria, but the easiest method is to check a macro variable. You can use SYSCC (built in error code that you can reset), or you can set a macro variable to indicate some other "error" condition (such as a data set that doesn't exist).

 

When you add your items to the Ordered List, the condition is still evaluated and the node won't run if the condition isn't met.

 

ChrisHemedinger_0-1787316491414.pngChrisHemedinger_0-1787316491414.png

ChrisHemedinger_1-1787316502703.pngChrisHemedinger_1-1787316502703.png

 

Become an Explorer! Join SAS Analytics Explorers to learn and complete challenges that earn rewards!
SASdevAnneMarie
Rhodochrosite | Level 12
Thank you,Chris!
SYSCC is an automatic variable, so I don't need to create it myself?
ChrisHemedinger
Community Manager

Yes, SYSCC is automatic and will have a non-zero value if an error occurs. But you can/should clear it with "%let SYSCC=0;" to reset it when you want to start from a clean slate.

 

SYSERR is another automatic variable, but you cannot reset that in the session (it is read-only).

Become an Explorer! Join SAS Analytics Explorers to learn and complete challenges that earn rewards!
SASdevAnneMarie
Rhodochrosite | Level 12
Thank you, Chris !
Can this macro variable take different values depending on whether it's a warning or a real error?
ChrisHemedinger
Community Manager

If I was doing setting this up, I wouldn't rely only on SYSCC. I would set a macro variable at the end of each step that was a flag for "all good?", depending on conditions.

 

So, this might be based on SYSCC, or existence of an expected data set, or some other combination of conditions. That will ensure that your next step runs only when all assumed "good" conditions have been satisfied.

Become an Explorer! Join SAS Analytics Explorers to learn and complete challenges that earn rewards!
SASdevAnneMarie
Rhodochrosite | Level 12
Thank you! I mean the SYSCC may not be equal to 0 when it's just a warning.
ballardw
Super User

Typiclly SYSCC will be 4 when a WARNING occurs.

There are some interactions with the ERRORCHECK system setting and some specific statements such as LIBNAME , FILENAME and %INCLUDE statements. You should read the online help for SYSCC for details.

 

These statements are likely just one reason that setting your own global macro variable might be a good idea.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 108 views
  • 3 likes
  • 3 in conversation