### input data vector with midpoint decimals
x <- c(-2.5, -1.5, -0.5, 0.5, 1.5, 2.5)
### rounds to integer
roundSAS(x, digits = 0)
### input data vector with a missing value
y <- c(8.65, 8.75, NA, 9.85, 9.95)
### rounds to tenths and label the missing value with "NE"
roundSAS(y, digits = 1, as_char = TRUE, na_char = "NE")
Run the code above in your browser using DataLab