If condition in model block

Hello,

I wonder if it is possible to define a Macro-variable to equal to a parameter. Something like
parameters sig_c;
sig_c=1;
@#define sig_c_par=sig_c

I am trying to estimate a model using Dynare. My model has a CRRA utility function, so the model equation of the utility function will be
U= c^(1-sig_c) / (1-sig_c) or U= log(c), depending on the intertemporal elasticity of substitution sig_c. I want to bayesian estimate sig_c, and I wonder how to tell dynare to use the equation U=log(c) when sig_c=1. I have tried the following code, but got the error msg ’ ERROR in macro-processor … Unknown variable: sig_c’.

parameters sig_c;
sig_c=1;
@#define sig_c_par=sig_c

model;
@#if sig_c_par==1
U=log(c);
@#else
U= c^(1-sig_c) / (1-sig_c);
@#endif

end;

Does anyone have a suggestion how to solve the problem? Any help will be much appreciated!

No, that is not possible. You need to do something like

@#define log_utility = 1

@#if log_utility ~= 1
parameters sig_c_par;
sig_c_par = any_value_you_like;
@#endif

model;
@#if log_utility==1
U=log(c);
@#else
U= c^(1-sig_c_par) / (1-sig_c_par);
@#endif
...
end;

Thank you, Johannes!

Hi, is this fixed in the later versions of dynare? Can we submit parameter values in @#if statements?

No, because the macro processor still only does text substitutions and does not evaluate contents at runtime.