1. You probably want to use CEIL, as others have suggested.
2. The simplest way to do it with ROUND is probably
t3 = round(total + 0.5);
3. However, you have to pay attention to boundary cases. How will my
formula in #2 behave when TOTAL is an integer? Your code will leave T3 as
a missing value since it does not handle T2=TOTAL.
4. If negative values of TOTAL are possible, you may not want to use CEIL.
It depends on whether "up" means up in magnitude or up toward zero.
On Fri, 3 Dec 2004 05:44:07 -0500, ben.powell@CLA.CO.UK wrote:
>Is this the best way to round up a variable to the nearest integer?
>t2 = round(total);
>if t2 > total then t3 = t2;
>if t2 < total then do;
> t2 = total + 0.5;
> t3 = round(t2);
>INPUT Acc_No Limit;
>CREATE TABLE CardData
>SELECT COALESCE(A.Acc_No, B.Acc_No) AS Acc_No, A.Balance, B.Limit
>FROM CardData AS A Full Join LimitData AS B
>ON A.Acc_No = B.Acc_No