Thank you! I think I get your point. You mean that 0.0572 could be recognized by SAS but 0.0572000000001 may not. But it seems not the problem of this. See r3 and r5 in the last result, the only difference is the specific value of the coupon rate. And I didn't plus any tiny amount to these two parameters. However, the function works for r5 but not r3. If it is the problem you mentioned, then it should not work for r5 either. BTW, I also tried to round the coupon rate from 0.0572 to 0.057 and 0.06. The function does not work with 0.057 but works with 0.06. And it also works with 0.032200000001 data z ; set z;
keep offering_date maturity coupon PV frequency basis r1 r2 r3 r4 r5 r6 r7 a;
a=round(coupon/100,0.01);
r1=finance('yield', offering_date, maturity, a, PV, 100, frequency, basis);
a2=round(coupon/100,0.001);
r2=finance('yield', offering_date, maturity, a2, PV, 100, frequency, basis);
r3=finance('yield', offering_date, maturity, coupon, PV, 100, frequency, basis);
r4=finance('yield', offering_date, maturity, 0.0572, PV, 100, frequency, basis);
r5=finance('yield', offering_date, maturity, 5.72, PV, 100, frequency, basis);
r6=finance('yield', offering_date, maturity, 0.0322, PV, 100, frequency, basis);
r7=finance('yield', offering_date, maturity, 0.032200000001, PV, 100, frequency, basis);
run; It's a little bit weird...🤔
... View more