Sample 24780: Using the CEIL function to always round up to the nearest integer
Return the smallest integer that is greater than or equal
to the argument.
Note:
To always round down to the nearest integer, use the FLOOR function. See Using the FLOOR function to always round down to the nearest integer.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
data a;
input num;
round_up=ceil(num);
datalines;
123.456
34
5.1111
7.68
10.98
-3.1
-19.0
-4.8
;
proc print;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Obs num round_up
1 123.456 124
2 34.000 34
3 5.111 6
4 7.680 8
5 10.980 11
6 -3.100 -3
7 -19.000 -19
8 -4.800 -4
Return the smallest integer that is greater than or equal
to the argument.
| Type: | Sample |
| Topic: | SAS Reference ==> DATA Step SAS Reference ==> Functions ==> Truncation
|
| Date Modified: | 2006-09-06 03:02:54 |
| Date Created: | 2004-09-30 14:09:13 |
Operating System and Release Information
| SAS System | Base SAS | All | n/a | n/a |