Mateusz Konopelski
Mateusz Konopelski

Reputation: 1042

SAS: conditional end of execution of code

This code will be part of process in SAS data Integration Studio.

I want to achieve something like:

%macro conditional_start();

%let check_condition = 0;

%if check_condition eq 0 %then %do;

    %send_email_that_condition_has_been_met(); /* this I have made */

    /*Below run some kind of built-in macro probably, to stop execution of the whole code below */


%end;

%mend;

/*More macros end code I don't want to execute*/

I cannot pack everything below in big "if" statement because they are built in blocks.

Is it possible?

Thanks in advance!!

Upvotes: 1

Views: 537

Answers (1)

Demitrios Karpoff
Demitrios Karpoff

Reputation: 11

Have you tried to put your code into "precode" (leave macro open) and "postcode" (rest of the macro) sections of your job's properties? For example:

precode:

%macro the_whole_job();

postcode:

%mend the_whole_job;

%macro conditional_start();
    %let check_condition = 0;
    %if check_condition eq 0 %then %do;
         %send_email_that_condition_has_been_met(); /* this You have made */
         /*do some kind of built-in macro meaning failure, not executing the whole code above*/
    %end;
    %else %do;
         %the_whole_job;
    %end; 
%mend;

Upvotes: 1

Related Questions