In need to round down to the nearest whole number or simply strip everything to the right of the decimal in a numeric field. Example:
have | need |
1.2 | 1 |
0.1 | 0 |
10 | 10 |
Use the FLOOR function to round down to the next integer.
data a;
input have;
need=floor(have);
datalines;
1.2
0.1
10
123.456
34
5.1111
7.68
10.98
-3.1
-19.0
-4.8
;
proc print;
run;
Use the FLOOR function to round down to the next integer.
data a;
input have;
need=floor(have);
datalines;
1.2
0.1
10
123.456
34
5.1111
7.68
10.98
-3.1
-19.0
-4.8
;
proc print;
run;
Remember that the floor function gives you the next lower number, so 3.1 yields 3 and -3.1 yields -4. The int function will give you 3 and -3 respectively. So, choose the one that meets your specific needs.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.