- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 12-05-2021 03:16 AM
(1616 views)
Hello
I want to round up to nearest 500.
For example:
Value 200 should be rounded to 500
Value 400 should be rounded to 500
Value 500 should be stay 500
Value 4400 should be rounded to 4500
Value 4000 should be stay 4000
what is the way to doi it please?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
target = round(source,500);
if target < source then target = target + 500;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data have;
input x;
want=ceil(x/500)*500;
cards;
200
400
500
4400
4000
;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
My solution:
data have;
input x;
want=roundz(x+250,500);
cards;
200
400
500
4400
4000
;
--
Paige Miller
Paige Miller