I’m using macro-loops in my .mod file to make it easier but strangely, when I want to test for one parameter to be equal to 0 or not, it’s working fine with one the loop (see line 88-90) and it’s not working with line 182 while it’s the same structure. Do you have an idea of what’s going on ? I think it’s a basic issue but I can’t find a way out of this.

if GAMMA_@{sectora+sectorb}
var M_@{sectora+sectorb};
end

is not a preprocessor command. It is only known at runtime to Dynare. That is no problem for the parameter initialization where Matlab expressions with if are valid. But it is not valid Dynare syntax within the model block.

Basically, how can we use an “if” condition in a model block ? In some equations of my model, I want some variables to be added only if they exist and this is why I need this “if” condition.

Okay : so we have a cobb-douglas production function with linkages between sectors. But since we have a cobb-douglas function, if a good is not an input for a sector, its import should be 0. But Dynare can’t compute the jacobians because then there are some values of imports that are initialized as 0.