ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Abud
Calcite | Level 5

Hello everbody!!

Is there a SAS function to round a number up?  The round() function

seems to round the number up or down depending on the rounding unit.

     round(233, 100);   ** will return 200;

     round(250, 100);   ** will return 300;

     This is what I want:

     round (233, 100);  ** will return 300;

     round (250, 100);  ** will return 300;

tk's in advanced!

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

%let unit=100;

* All you can do is :

data _null_;

up = &unit*CEIL(233/&unit);

down = &unit*FLOOR(255/&unit);

put down= up=;

run;

PG

PG

View solution in original post

3 REPLIES 3
PGStats
Opal | Level 21

%let unit=100;

* All you can do is :

data _null_;

up = &unit*CEIL(233/&unit);

down = &unit*FLOOR(255/&unit);

put down= up=;

run;

PG

PG
PGStats
Opal | Level 21

Or you can define your own...


proc fcmp outlib=sasuser.mysubs.math;
function upround(x, unit);
return (unit*CEIL(x/unit));
endsub;
function downround(x, unit);
return (unit*FLOOR(x/unit));
endsub;
run;

options cmplib=sasuser.mySubs;

data _null_;
up = upRound(233,100);
down = downRound(255,100);
put down= up=;
run;

PG

PG
Abud
Calcite | Level 5

tk's PG !

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 6535 views
  • 3 likes
  • 2 in conversation