I have problems converting a piece of Matlab-code into SAS. It concerns an iteration for a number (Nx) of items, all of different age (tau). Depending on the age of each item I have to use parts of two function lambda(t1) and Fl(t2).
I have calculated lambda and Fl earlier in the program. I can store them either as data-step variables or as macro variables using call symput ('lambda'||strip(t1),lambda);. The dataset with e.g lambda contains one column t1 and one column with the lambda-value.
IT.delday is stored in a data-set containing item-information.
For those of you how are not familiar with Matlab. The function "min" takes the minimum value of tau-1 and 365 and t1 is a vector with values spanning from 1 to this minimum value, in steps of 1. t2 is thus also a vector. .* denotes element-wise multiplication.
for j = 1:Nx
tau = calculationday-IT.delday(j);
t1 = [1:1:min(tau-1,365)];
t2 = tau-t1;
denom = denom + sum(lambda(t1).*Fl(t2));
end;
I really appreciate your help.
Annette
I have calculated lambda and Fl earlier in the program. I can store them either as data-step variables or as macro variables using call symput ('lambda'||strip(t1),lambda);. The dataset with e.g lambda contains one column t1 and one column with the lambda-value.
IT.delday is stored in a data-set containing item-information.
For those of you how are not familiar with Matlab. The function "min" takes the minimum value of tau-1 and 365 and t1 is a vector with values spanning from 1 to this minimum value, in steps of 1. t2 is thus also a vector. .* denotes element-wise multiplication.
for j = 1:Nx
tau = calculationday-IT.delday(j);
t1 = [1:1:min(tau-1,365)];
t2 = tau-t1;
denom = denom + sum(lambda(t1).*Fl(t2));
end;
I really appreciate your help.
Annette