# Variable List and Macro-language

**URL:** <https://forum.dynare.org/t/variable-list-and-macro-language/19126>\
**Category:** Uncategorized\
**Created:** [19 October 2021 14:52 UTC](https://forum.dynare.org/t/variable-list-and-macro-language/19126 "2021-10-19T14:52:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahil](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@sahil](https://forum.dynare.org/u/sahil)\
**Post date:** [19 October 2021 14:52 UTC](https://forum.dynare.org/t/variable-list-and-macro-language/19126/1 "2021-10-19T14:52:14Z")

</div>

Dear Professor,

In the model block of the mod file, I can use macro processor to create the list of equations as follows:

@#define j=100  
@#for i in 1:j  
i\_d@{i}=i(-@{i})-i\_star(-@{i});  
@#endfor

But, I also have to write these 100 variables in the list of ‘var’ and I want to create the IRFS of these, so I need to write them in the stoch\_simul command as well along with the other variables.  
If I do this manually, I will write as:  
var i\_d1, i\_d2,…,i\_d100;  
stoch\_simul(order=1,irf=20) i\_d1, i\_d2,…,i\_d100;

I am wondering if I can use the macro processor for these as well. Any help would save a lot of my time.

Best Regards  
Sahil

---

<div class="post-metadata">

**Author:** ![sebastien](https://forum.dynare.org/user_avatar/forum.dynare.org/sebastien/32/19973_2.png) [@sebastien](https://forum.dynare.org/u/sebastien)\
**Post date:** [19 October 2021 14:55 UTC](https://forum.dynare.org/t/variable-list-and-macro-language/19126/2 "2021-10-19T14:55:47Z")

</div>

You can do something like:

```auto
var
@#for i in 1:j
 i_d@{i}
@#endfor
;

```

Don’t forget the semicolon on the last line. And note that you can have several `var` statements in a single file.

You can do the same for the call to `stoch_simul`:

```auto
stoch_simul(order=1,irf=20)
@#for i in 1:j
 i_d@{i}
@#endfor
;

```

---

<div class="post-metadata">

**Author:** ![sahil](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@sahil](https://forum.dynare.org/u/sahil)\
**Post date:** [19 October 2021 15:03 UTC](https://forum.dynare.org/t/variable-list-and-macro-language/19126/3 "2021-10-19T15:03:02Z")

</div>

Dear Sebastien,

Thank you so much for the help.

Best Regards  
Sahil
