# Loop

**URL:** <https://forum.dynare.org/t/loop/561>\
**Category:** Dynare help (legacy posts)\
**Created:** [24 January 2008 10:28 UTC](https://forum.dynare.org/t/loop/561 "2008-01-24T10:28:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cortomaltese79](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@cortomaltese79](https://forum.dynare.org/u/cortomaltese79)\
**Post date:** [24 January 2008 10:28 UTC](https://forum.dynare.org/t/loop/561/1 "2008-01-24T10:28:44Z")

</div>

I would like to run my Dynare’s code 100 times in a row. I think I have to do some kind of loop, but I am not sure I understood how.  
Can anyone give me some hints or maybe send an example?  
Many thanks.

---

<div class="post-metadata">

**Author:** ![MichelJuillard](https://forum.dynare.org/user_avatar/forum.dynare.org/micheljuillard/32/5318_2.png) [@MichelJuillard](https://forum.dynare.org/u/MichelJuillard)\
**Post date:** [24 January 2008 10:59 UTC](https://forum.dynare.org/t/loop/561/2 "2008-01-24T10:59:15Z")

</div>

It is usually better to write the loop inside the \*.mod file than run Dynare in a loop. Tell us more about what you want to do and why.

Best

Michel

---

<div class="post-metadata">

**Author:** ![cortomaltese79](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@cortomaltese79](https://forum.dynare.org/u/cortomaltese79)\
**Post date:** [24 January 2008 14:03 UTC](https://forum.dynare.org/t/loop/561/3 "2008-01-24T14:03:02Z")

</div>

I would like to run my Dynare code 100 times to calculate then the average standard deviations and to compare them with the actual statistics.

---

<div class="post-metadata">

**Author:** ![MichelJuillard](https://forum.dynare.org/user_avatar/forum.dynare.org/micheljuillard/32/5318_2.png) [@MichelJuillard](https://forum.dynare.org/u/MichelJuillard)\
**Post date:** [24 January 2008 14:15 UTC](https://forum.dynare.org/t/loop/561/4 "2008-01-24T14:15:29Z")

</div>

Why don’t you want to use the theoretical moments. In a linear model, you don’t have to simulate to get the moments of the process

Best

Michel

---

<div class="post-metadata">

**Author:** ![cortomaltese79](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@cortomaltese79](https://forum.dynare.org/u/cortomaltese79)\
**Post date:** [25 January 2008 09:12 UTC](https://forum.dynare.org/t/loop/561/5 "2008-01-25T09:12:59Z")

</div>

Ok, I will try,  
Thanks a lot.
