long and not very efficient way. use this if you have few columns and few values
data a;
input value1 value2 value3;
cards;
4 6 5
5 7 3
3 2 2
2 4 1
;
run;
data b;
input Parameter $ amount;
cards;
value1 .5
value2 .1
value3 1
;
run;
data a1;
set a;
col =_n_;
run;
proc sql;
select coalesce(tot1,0) +coalesce(tot2,0)+coalesce(tot3,0) as final_total from
(select value1, col,
case when value1 and parameter = 'value1' then value1*amount end as tot1
from a1 cross join b
where calculated tot1 is not missing)x
inner join
(select value2,col,
case when value2 and parameter = 'value2' then value2*amount end as tot2
from a1 cross join b
where calculated tot2 is not missing)y
on x.col =y.col
inner join
(select value3,col,
case when value3 and parameter = 'value3' then value3*amount end as tot3
from a1 cross join b
where calculated tot3 is not missing)z
on x.col =z.col;
;
... View more