BookmarkSubscribeRSS Feed
nilu10686
Calcite | Level 5

Hi All,

I want to generate a alert message when one of my process get failed in base sas.

for example: i run a program to update my database with current records. but it failed.

how i get to know?

1 REPLY 1
jimbarbour
Meteorite | Level 14

You can check the macro variable SYSCC.  SYSCC is going to capture about 90% of errors.  After an SQL call, you can check SQLRC.

 

Something like this:

%MACRO Check_RC;
    %GLOBAL SQLRC;

    %IF  &SYSCC >= 8 OR
        &SQLRC >= 8 %THEN
        %DO;
            (Send an email here or whatever you think appropriate)
        %END;
%MEND;

You have to declare SQLRC but SYSCC is always present.

 

Then after each Data or Proc step you would code the following:

%Check_RC;

However, there are a few Errors in SAS that for whatever reason do not get captured in the SYSCC.  What I do is look at the SYSERRORTEXT macro variable and compare it to a copy I have saved.  If SYSERRORTEXT is not blank and is not equal to the value from the last time I executed %Check_RC, then I also consider that an error even if SYSCC is still zero.  A zero return code is considered good.  A 4 is considered a warning.  An 8 or greater is considered an error.  Occasionally there are some values of 1, but those are mostly in another status variable, SYSFILRC.

 

Jim

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 570 views
  • 1 like
  • 2 in conversation