# Macro-processor language and loops

**URL:** <https://forum.dynare.org/t/macro-processor-language-and-loops/5627>\
**Category:** Macro-language\
**Created:** [6 July 2016 14:15 UTC](https://forum.dynare.org/t/macro-processor-language-and-loops/5627 "2016-07-06T14:15:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niki](https://forum.dynare.org/letter_avatar_proxy/v4/letter/n/c57346/32.png) [@Niki](https://forum.dynare.org/u/Niki)\
**Post date:** [6 July 2016 14:15 UTC](https://forum.dynare.org/t/macro-processor-language-and-loops/5627/1 "2016-07-06T14:15:44Z")

</div>

Dear all,

I am having a question concerning macro-processing language and loops in Dynare 4.4.3. I am using the macro-processing language to define new macro-processor variables, where I can have conditional statements on thereafter in the mod file. My question is whether I can have loops on the macro-processor variable values, outside of the mod file, in a separate m file. So for example, for different values of these macro-processor variables, run the dynare \*.mod file.

Thank you for your help in advance.

Best,  
Niki

---

<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:** [7 July 2016 08:55 UTC](https://forum.dynare.org/t/macro-processor-language-and-loops/5627/2 "2016-07-07T08:55:47Z")

</div>

No, that is not possible, but you can use Matlab variables outside of the mod-file and pass them to the mod-file to set preprocessor variables. That should to the trick. This can be done with the `-D` switch in the command line. See [[Loop over certain antizipation horizons](https://forum.dynare.org/t/loop-over-certain-antizipation-horizons/5443/1))

---

<div class="post-metadata">

**Author:** ![Niki](https://forum.dynare.org/letter_avatar_proxy/v4/letter/n/c57346/32.png) [@Niki](https://forum.dynare.org/u/Niki)\
**Post date:** [2 August 2016 11:58 UTC](https://forum.dynare.org/t/macro-processor-language-and-loops/5627/3 "2016-08-02T11:58:02Z")

</div>

Dear Johannes,

Thank you so much. It works perfectly.

Kind regards,  
Niki
