# If statement

**URL:** <https://forum.dynare.org/t/if-statement/5961>\
**Category:** Dynare help (legacy posts)\
**Created:** [4 January 2017 16:52 UTC](https://forum.dynare.org/t/if-statement/5961 "2017-01-04T16:52:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcio\_fr](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/ac91a4/32.png) [@marcio\_fr](https://forum.dynare.org/u/marcio_fr)\
**Post date:** [4 January 2017 16:52 UTC](https://forum.dynare.org/t/if-statement/5961/1 "2017-01-04T16:52:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [5 January 2017 15:13 UTC](https://forum.dynare.org/t/if-statement/5961/2 "2017-01-05T15:13:03Z")

</div>

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.
