全て、
SAS が 2 つの 2 進変数の減算を処理する方法に関連する問題が発生しています。これらの結果は DB2 データベースに書き込まれます。ここで使用されているすべてのフィールドは SAS にインポートされ、DECIMAL(19,2) のデータ型で DB2 フィールドに書き込まれます。問題は次のとおりです。
AL_AMT - PL_AMT = DIF_AMT
From SAS: 9,918,322.38 - 9,942,322.30 = (23,999.91)
Expected: 9,918,322.38 - 9,942,322.30 = (23,999.92)
以下は、非常にトリミングされたコードのスニペットです。SASは間違いなく風変わりです。誰かが、その多くの癖のどれがこれを引き起こしているのかを発見するのを手伝ってくれることを願っています.
/* CAmt and PPmt are retrieved from a lengthy PROC SQL statement, */
/* their formats are unaltered. */
data WORK.TABLE1;
set WORK.TABLE0;
Difference = CAmt - PPmt;
run;
data WORK.TABLE2(keep=Rep:);
set WORK.TABLE1 end=last;
If _N_=1 then do;
Rep1CAmt=0;
Rep1PPmt=0;
Rep1Diff=0;
end;
Rep1CAmt+CAmt;
Rep1PPmt+PPmt;
Rep1Diff+Difference;
if last;
Rep1Diff=Rep1CAmt-Rep1PPmt;
Rep1Diff=round(Rep1Diff,.01);
/* I realize these two lines are redundant/unnecessary, but I was trying
different things to get the numbers to add up correctly, no such luck */
run;
data WORK.TABLE3;
set work.TABLE2;
AL_AMT=round(Rep1CAmt,.01);
PL_AMT=round(Rep1PPmt,.01);
DIF_AMT=AL_AMT-PL_AMT;
run;
proc append data=WORK.TABLE3 base=LIBNAME1.DB2TABLE(drop=ID) force;
run;