Page 1 of 1

If statement

PostPosted: Wed Jan 04, 2017 4:52 pm
by marcio_fr
Hi,
I would like to know if it is possible to use the conditional statement "if" with a model variable. Something like:

@#if model_variable <= value
equation1
@#else
equation2
@#endif

Best regards, Márcio.

Re: If statement

PostPosted: Thu Jan 05, 2017 3:13 pm
by jpfeifer
No, that is not possible. Macro-processor statements are evaluated before processing the model. Therefore, the value you test must be known in advance. I guess you have in mind a model where endogenously you use either one or the other equation depending on the value of the variable in that period. That is a different issue than constructing a mod-file. You may be able to work with a min/max construct to get the desired result.