Stata 11 help for int()

help int() -------------------------------------------------------------------------------

Title

[D] functions -- Functions

Mathematical function

int(x) Domain: -8e+307 to 8e+307 Range: integers -8e+307 to 8e+307 Description: returns the integer obtained by truncating x toward 0; thus, int(5.2) = 5 int(-5.2) = -5 returns x (not ".") if x is missing, meaning that int(.a) = .a.

One way to obtain the closest integer to x is int(x+sign(x)/2), which simplifies to int(x+0.5) for x > 0. However, use of the round() function is preferred. Also see round(x), ceil(x), and floor(x).

trunc(x) is a synonym for int(x).

Also see

Manual: [D] functions

Help: [D] functions, [D] functions (math functions)


© Copyright 1996–2010 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index