Sample 24643: Use the FLOOR function to always round down to the next integer
Return the smallest integer that is less than or equal
to the argument.
Note:
To always round up to the nearest integer, use the CEIL function. See Using the CEIL function to always round up 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_down=floor(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.
round_
Obs num down
1 123.456 123
2 34.000 34
3 5.111 5
4 7.680 7
5 10.980 10
6 -3.100 -4
7 -19.000 -19
8 -4.800 -5
Return the smallest integer that is less 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:00 |
Operating System and Release Information
| SAS System | Base SAS | All | n/a | n/a |