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.
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.png
ChrisHemedinger_1-1787316502703.png
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).
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.
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.
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.
Ready to level-up your skills? Choose your own adventure.