Zero Division Error

Hi!
I was trying to create a model for Mozambique. But the program gets zero division error every time. I see gaps in my data set, but I don’t know how I can fill them. Any ideas?
MOZSAM_test.gms (5.72 KB)
MOZSAM.xlsx (175 KB)

Hi Merey,

Running your code, I get

--- MOZSAM_test.gms(165) 4 Mb[FIL:"C:\Users\ffian\Documents\support\MOZSAM_test.gms",165,0]
*** Error at line 165: division by zero (0)[LST:522]
--- MOZSAM_test.gms(171) 4 Mb 1 Error[FIL:"C:\Users\ffian\Documents\support\MOZSAM_test.gms",171,0]
*** Error at line 171: division by zero (0)[LST:523]
--- MOZSAM_test.gms(899) 6 Mb 2 Errors

The corresponding lines in the echo print are

165  tq(c)=SAM("stax",c)/QQ0(c);
[...]
171  tim(c) = SAM("mtax",c)/SAM("ROW",c);

If QQ0(c) is zero for certain c, you get a division by zero error. The question is, what should tq(c) be for those elements in c? You could for example just skip those c by adding a simple dollar condition

tq(c)$QQ0(c)=SAM("stax",c)/QQ0(c);

You could use the same “trick” in line 171 as well. The question is, whether this gives you the desired results? You are the only person that can answer this question.

I hope this helps!

Fred