Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting matlab matrix code to SAS

Status
Not open for further replies.

AnnetteMH

Programmer
Oct 20, 2009
1
SE
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top