Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limiting decimal precision in calculations

I currently have a very large dataset in SPSS where some variables have up to 8 decimal places. I know how to change the options so that SPSS only displays variables to 2 decimal places in the data view and output. However, SPSS still applies the 8 decimal precision in all calculations. Is there a way to change the precision to 2 decimal places without having to manually change every case?

like image 460
Matthew Hall Avatar asked Nov 16 '25 11:11

Matthew Hall


1 Answers

You'll have to round each of the variables. You can loop through them like this:

do repeat vr=var1 var2 var3 var4 var5.
   compute vr=rnd(vr, 0.01).
end repeat.

If the variables are consecutive in the file you can use to like this:

do repeat vr=var1 to var5.
....
like image 55
eli-k Avatar answered Nov 19 '25 10:11

eli-k



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!