Parameters dependent Macro expressions problem

Dynare always complains unknown variables when I put parameters (like parameter lam in the following code) in macro-expressions. I have to do some algebra for lam within the mod file. So it is not convinenent to use -D option after dynare command. Any ways out of this?

parameters alpha beta...... lam;
alpha = 0.1;
beta =0.95;
......
lam = alpha+ beta+....;
...
@#define iszero = (lam > 0)
  1. Can you provide a code to execute showing the problem.
  2. Do I understand it correctly that you want to condition parts of the code on the value of a parameter combination?
  1. Here is the code: aa2016_nonlinear_iterated_post.mod (5.2 KB)

  2. Yes, you are right.

Thank you for help!

What you are having here is not possible at the macro processor level. The expressions you are having depend on parameter evaluations not known when the preprocessor parses the file. These evaluations are only conducted when executing the Matlab codes. But you may be able to use something like

parameters isGS;
isGs =  (Gs ==0)
model;
exp(Y)  = exp(C) + isGs*(G) + (1-isGs)exp(G);

instead of

@#if isGs
exp(Y)  = exp(C) + (G);
@#else
exp(Y)  = exp(C) + exp(G);
@#endif

Thank you very much for the help. @jpfeifer