turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Matlab matrix-calculation to SAS

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-19-2009 05:35 AM

Hi,

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. 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 the minimum value just calculated, in steps of 1. “.*” denotes element-wise multiplication.

for j = 1:Nx(k), %There are Nx items for period k

tau = calculationday-IT.delday(j); %tau is age of item on calculation day

t1 = [1:1:min(tau-1,365)];

t2 = tau-t1;

denom(k) = denom(k) + sum(lambda(t1).*Fl(t2));

end;

I really appreciate your help.

Annette

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. 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 the minimum value just calculated, in steps of 1. “.*” denotes element-wise multiplication.

for j = 1:Nx(k), %There are Nx items for period k

tau = calculationday-IT.delday(j); %tau is age of item on calculation day

t1 = [1:1:min(tau-1,365)];

t2 = tau-t1;

denom(k) = denom(k) + sum(lambda(t1).*Fl(t2));

end;

I really appreciate your help.

Annette