What values are you subtacting from what other values?
Do you always have exactly two tables, and are those tables identical in their ID structure? If so, assuming you want to substract table B from table A, you can still interleave the data sets using a SET with a BY statement, and then use the DIF function, as in:
data want;
set tableb tablea;
by id;
array nums {2} num_a num_b;
do I=1 to dim(sums);
nums{I}=dif(nums{I});
end;
if last.id;
run;
The DIF function is X-lag(X). So when the record-in-hand is the second record for a by-group (i.e. the tablea record), it's subtracting the prior value (i.e. from tableB above) from the current (tableA). Of course when the record-in-hand is the beginning of a by-group, the result is nonsense, but the subsetting "if last.id;" statement excludes that record.
If you had used "set tablea tableb" instead, you would have gotten B-A.
... View more