SPM Formulas – Divide by Zero errors

Been struggling with how to trap a divide by zero issue’s in SPM formulas, so we don’t show the dreaded NULL value.

With a little help from SAS support, finally worked out what I need is:

IF(([ELE=current('ELE')][COL='xxxxxx'][PER=current('PER')]/[ELE=current('ELE')][COL='xxxxxx1'][PER=current('PER')]) = _ERROR_ , 0,([ELE=current('ELE')][COL='xxxxxx'][PER=current('PER')]/[ELE=current('ELE')][COL='xxxxxx1'][PER=current('PER')]/100))

So basically if the dividing calculation results in an error (i.e one of the dividers is 0 or missing) then put a 0, otherwise do the calc.

  • Share/Bookmark