BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mlogan
Lapis Lazuli | Level 10

Hi All,

can anyone tell me the code how to round a data to it's next integer value? I know how to round down (9.81 to 9), but I don't know how to round up (9.01 to 10) 

here is the code I know for rounding except rounding to the next integer.

data round;

input no;

datalines;

9.9

9.4

9.5

9.047

9.55

9.006

9.004

9.999

9.6

9.1

;

run;

data newround;

set round;

value1 = round(no);      *rounding to the nearest integer;

value2 = int(no);     *Keep the integer only;

value3 = round(no,0.01); *rounding to the nearest second decimal;

run;

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
billfish
Quartz | Level 8

you may try using the ceil() function.

value4 = ceil(no);

View solution in original post

3 REPLIES 3
billfish
Quartz | Level 8

you may try using the ceil() function.

value4 = ceil(no);

mlogan
Lapis Lazuli | Level 10

thanks, it's working!!!

Reeza
Super User

If the solution above works for you please mark this (and other) questions as answered.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 8628 views
  • 0 likes
  • 3 in conversation