2

I want to create a user written transformation to skip further job execution when certain condition is true. I have tried the code

        %abort;
        %abort cancel;

but these statements gives error, something like Stopped processing because of %abort statement. I don't want an error message to be displayed, just skip the remaining job execution. e.g. If my source table has zero observations then get out of the job without logging error message or warning.

mac_21
  • 113
  • 9

1 Answers1

2

Hmm, not sure if this will work in SAS DI (I don't have it to test), but what we use is the below macro:

%macro stop_sas;
  %if "&sysenv" eq "FORE" %then %do;
    %abort cancel;
  %end;
  %else %do;
    endsas;
  %end;
%mend;

It basically checks to see if SAS is running as a batch job or not, and if it is, quits SAS quietly. If SAS is running in interactive mode, then it will just abort the submitted code, without closing the IDE.

The key statement here is the endsas command - which is probably the part you are looking for.

Robert Penridge
  • 8,424
  • 2
  • 34
  • 55