If statement

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

If statement

Postby marcio_fr » Wed Jan 04, 2017 4:52 pm

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.
marcio_fr
 
Posts: 22
Joined: Fri Nov 27, 2009 7:14 pm

Re: If statement

Postby jpfeifer » Thu Jan 05, 2017 3:13 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 7 guests