If the weight depends on the ID then why not just put them into another dataset instead of storing the weights in the code?
data have;
input xyz_id letter $ Col_1 col_2;
cards;
1 Z 2 1
2 Z 3 2
3 Z 4 3
;
data weights;
input xyz_id weight1-weight3 ;
cards;
1 1 2 3
2 8 7 6
3 1 1 1
;
data want;
merge have weights ;
by xyz_id;
array weights weight1-weight3 ;
array letters [3] $3 _temporary_ ('A' 'B' 'C');
array old col_1-col_2;
array new new_1-new_2;
do i=1 to dim(letters);
letter=letters[i];
do j=1 to dim(old);
new[j] = old[j] * weights[i];
end;
output;
end;
run;
proc print;
run;
PS It is just as easy to type the data step to create the data as it is to type those tables with the |'s in them. And if you use the Insert SAS Code icon so you get a fixed font it is just as easy to read. The |'s just limit the amount of information you can put on a line.
... View more