NewJC
NewJC

Reputation: 21

SAS - always round up to two decimal places?

Im trying to round a decimal that is currently 4 places into two but rounding up always.

As an example 0.2407 should round to 0.25. Is there a way to do this? Ceil is integer only and round(x,0.01) returns 0.24 as expected.

Upvotes: 1

Views: 1091

Answers (1)

Egor Lipchinskiy
Egor Lipchinskiy

Reputation: 269

One of the solution could be:

y = ceil (x*100) / 100;

Example:

data a;
  x = 0.2407;
  y = ceil (x*100) / 100;
  put x= y=;
run;

Log:

x=0.2407 y=0.25

Upvotes: 3

Related Questions