I have a data set: Path AB_1 AB_2 AB_3 AB_4 AB_5 AB_6 AB_7 1 -1.0 23 12 -2.003 12 4 2 2 2 -13.2 -3.08 1 3 -1.233 -1.6 3 13 24 2 4 -2.875 1 3 I want to set a start number and an end number (i.e. start = 3 and end = 5) such that I can get: Path AB = AB_3*AB_4*AB_5 1 -288.432 2 -9.24 3 -23 So then if I want to specify start multiplying from AB_4 to AB_7, the code can do it for me. Currently I'm trying to use a %do loop but I notice that the multiplication operator (*) causes the statement to become a comment: %macro compound_n_year(start =, end =);
data AB(keep = path &prov.);
retain path;
set data_st;
&prov. = (
%do i = 0 %to %eval(&end. - &start.);
%if &i. = 0 %then %do;
(1+AB_%eval(&start.+&i.))
%end;
%else %do;
*(1+AB_%eval(&start.+&i.))
%end;
%end;
)**12;
run;
%mend; I'm looking into arrays, and notice that there is no "product()" function available to me. Is there an alternative way for me to implement the function? I believe proc iml is not available to me. Thank you
... View more