SAS (Base SAS)+
data round_demo;
input value;
datalines;
3.1416
2.718
9.99
1.5
-4.75
;
run;
data round_results;
set round_demo;
round_val = round(value);
round_dec = round(value,0.01);
ceil_val = ceil(value);
floor_val = floor(value);
run;- In SAS,
round(value)rounds to the nearest integer using the round-half-up rule. round(value, 0.01)rounds to the nearest two decimal places; the second argument is the rounding unit, not a digit count.ceil(value)returns the smallest integer greater than or equal to the value — always steps upward.floor(value)returns the largest integer less than or equal to the value — always steps downward.- On 1.5, SAS
round()returns 2; on -4.75 rounded to two decimals, it returns -4.75 (already aligned). - We run and confirm each derived column reflects the intended rounding rule; pay attention to the 1.5 row as the half-case test.