I am very keen to learn whether I can handle or not such situations in SAS Base without using SAS IML;
Let's say I have the vector have
a b c d e f
1001 JPN 10,000 50% JPN 2,000
1001 EUR 12,648 100% EUR 3,000
1001 USD 15,997 50% USD 5,000
1001 JPN 20,233 20% JPN 8,000
1001 EUR 25,591 20% EUR 9,000
1001 USD 32,368 50% USD 4,000
1002 JPN 28,393 50% JPN 6,000
1002 EUR 24,906 100% EUR 4,000
1002 USD 21,847 50% USD 8,000
1002 TRY 19,164 20% JPN 6,000
1002 EUR 16,811 50% EUR 15,000
1002 USD 14,746 100% USD 52,000
1003 USD 10,000 50% XVN 8,000
%macro;
% let i = 1;
data want;
set have;
%do %while a[&i]=a[eval(&i+1)] ;
b = &i;
&i=eval(&i+1);
%end
%mend
What I would like to do is for a with b=e to take the difference of max(c) and max(f) and multiply this difference with d and then for each distinct a to sum these outcomes. This will be iterative. The table I compose here just a small representation of the case.
Thanks