Hi, is there a way to make if statement more efficient? I ve got about 80 mln obs with over 80 if statments in loop, processing this dataset takes couple of hours? Belowe you will find scrap of the code: %Macro test(x_date)
data want;
set have;
%do i=3 %to 12 %by 3;
if datepart(date)>=intnx('month', "&x_date"d,%eval(-&i+1), 'B') and datepart(data_danych)<=intnx('month', "&x_date"d,0,'E') and kod_3 = '1001' then do;
var1_&i.m=round(amount*exch_rete,0.01);
end;
else if datepart(date)>=intnx('month', "&x_date"d,%eval(-&i+1), 'B') and datepart(data_danych)<=intnx('month', "&x_date"d,0,'E') and kod_3 = '1201' then do;
var2_w_UP_&i.m=round(amount*exch_rate,0.01);
end;
else if datepart(date)>=intnx('month', "&x_date"d,%eval(-&i+1), 'B') and datepart(data_danych)<=intnx('month', "&x_date"d,0,'E') and kod_3 in ('1041','1241') then do;
var3_&i.m=round(amount*exch_rate,0.01);
end;
........
%end;
run;
%mend;
test(31AUG2017); Thank you.
... View more