p***@gmail.com
2016-05-06 14:06:45 UTC
SPSS RND Function
Rounding numbers in SPSS is done with the RND function. RND takes an optional second argument, which is the nearest value to round to. You can round to the nearest quarter point (second example below) or tenfold (third example).
If the second argument is omitted, values will be rounded to the nearest integer (first example).
http://www.spss-tutorials.com/spss-main-numeric-functions/
Rounding numbers in SPSS is done with the RND function. RND takes an optional second argument, which is the nearest value to round to. You can round to the nearest quarter point (second example below) or tenfold (third example).
If the second argument is omitted, values will be rounded to the nearest integer (first example).
http://www.spss-tutorials.com/spss-main-numeric-functions/
Hi,
I was wondering if anyone had any advice or suggestions on how to
successfully round up/down computed values within SPSS. Although I
recognize that SPSS allows for various arithmetic functions within the
COMPUTE statement (including RND, example below), this only allows for
rounding to the nearest integer. Unfortunately, this doesn't help me much
because I am looking to round values up to the nearest .5. For example, I
wish to somehow run a compute command which will change values of 1.33 to
1.5 or a value of 1.67 to 2.0. Are there further specifications to the
COMPUTE - RND syntax below which will allow this? What I am attempting to
avoid is creating a series of IF statements which capture values > and < in
order to convert these to the nearest .5 (b/c of the number of variables and
values in the data set).
COMPUTE variable2 = RND(variable1*2)/2 .
or alternatively,
COMPUTE var2 = .5*(rnd(2*var1)) .
1.00 to 1.24 = 1.0
1.25 to 1.74 = 1.5
1.75 to 1.99 = 2.0
Are there any suggestions on how to get values such as 1.67 to round up to
2.0 rather than round down to 1.5? Mathematically the method seems
"sound," however, I can't help but feel that, subjectively, 1.67 should be
2.0 rather than 1.5. I'm not sure if anyone else agrees or what the exact
"stand" on rounding really is. .
Any help would be greatly appreciated.
Thanks in advance,
M. Justice
I was wondering if anyone had any advice or suggestions on how to
successfully round up/down computed values within SPSS. Although I
recognize that SPSS allows for various arithmetic functions within the
COMPUTE statement (including RND, example below), this only allows for
rounding to the nearest integer. Unfortunately, this doesn't help me much
because I am looking to round values up to the nearest .5. For example, I
wish to somehow run a compute command which will change values of 1.33 to
1.5 or a value of 1.67 to 2.0. Are there further specifications to the
COMPUTE - RND syntax below which will allow this? What I am attempting to
avoid is creating a series of IF statements which capture values > and < in
order to convert these to the nearest .5 (b/c of the number of variables and
values in the data set).
COMPUTE variable2 = RND(variable1*2)/2 .
or alternatively,
COMPUTE var2 = .5*(rnd(2*var1)) .
1.00 to 1.24 = 1.0
1.25 to 1.74 = 1.5
1.75 to 1.99 = 2.0
Are there any suggestions on how to get values such as 1.67 to round up to
2.0 rather than round down to 1.5? Mathematically the method seems
"sound," however, I can't help but feel that, subjectively, 1.67 should be
2.0 rather than 1.5. I'm not sure if anyone else agrees or what the exact
"stand" on rounding really is. .
Any help would be greatly appreciated.
Thanks in advance,
M. Justice