Ankit
Ankit

Reputation: 75

Skipping by 2 in a MACRO

I want to skip by two datasets in the following macro:

%macro bulk_ODI_extract(low_id,high_id);
    %do loop_match=&low_id %to &high_id; 
        %ODI_commentary(&loop_match,2);
    %end;
%mend bulk_ODI_extract;

%bulk_ODI_extract(749781,749787);

So the final dataset should include 749781, 749783, 749785 and 749787, while skipping 749782, 749784 and 749786.

Upvotes: 1

Views: 50

Answers (1)

SRSwift
SRSwift

Reputation: 1710

Use the %by statement to set the interval of your loop's itterations.

%macro bulk_ODI_extract(low_id,high_id);
    %do loop_match=&low_id %to &high_id %by 2; 
        %ODI_commentary(&loop_match, 2);
    %end;
%mend bulk_ODI_extract;
%bulk_ODI_extract(749781,749787);

Upvotes: 6

Related Questions