Avoid divide by zero
Added by Marston Ward over 12 years ago
Hi,
How do you, if you can, divide two variables in a file and avoid dividing by zero? I thought about doing this using expr,'var=(1 - x/y)' but y has 0 values.
I want to avoid modifying y and replacing the 0s. I looked at ifthen ifthenelse but these seem to work on separate files.
Any suggestions?
/M
Replies (2)
RE: Avoid divide by zero - Added by Jaison-Thomas Ambadan over 12 years ago
Hi Marton,
try to set 0 as a missing value using setmissval or setctomiss operators
Cheers,
J.