Just a minor side note: When you do arithmetic with money amounts with (typically) two decimal places, rounding errors can easily occur that you might not expect. I would use the ROUND function to rectify those errors.
Example:
655 data test;
656 amount1=2.20;
657 amount2=1.20;
658 unearned_bal=1;
659 crude = amount1 - amount2 - unearned_bal;
660 if crude ne 0 then put 'Surprised?' +1 crude;
661 amount2 = round(amount1 - amount2 - unearned_bal, 1e-7);
662 if amount2=0 then put 'OK!';
663 run;
Surprised? 2.220446E-16
OK!
If you know that none of your amounts and balances has more than two decimals (i.e., involves fractions of a cent), using 0.01 as the rounding unit is even safer than the suggested 1e-7.
... View more