# Refer to specific element of macro vector

**URL:** <https://forum.dynare.org/t/refer-to-specific-element-of-macro-vector/18230>\
**Category:** Macro-language\
**Created:** [4 June 2021 14:42 UTC](https://forum.dynare.org/t/refer-to-specific-element-of-macro-vector/18230 "2021-06-04T14:42:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tintin\_milou](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@tintin\_milou](https://forum.dynare.org/u/tintin_milou)\
**Post date:** [4 June 2021 14:42 UTC](https://forum.dynare.org/t/refer-to-specific-element-of-macro-vector/18230/1 "2021-06-04T14:42:52Z")

</div>

Hi,  
I saw the following example on the slides for the dynare summer school 2019 on the macro-processing language. I wonder if it is possible to adapt this example such that the nth\_co is not the US, but simply the first (or second,…) element of the “countries” vector. That way, I do not need to manually change the nth\_co if I happen to kick the US out of the model.  
Thanks.

@#define countries = [“US”, “EA”, “AS”, “JP”, “RC”]  
@#define nth\_co = “US”  
@#for co in countries  
var Y\_@{co} K\_@{co} L\_@{co} i\_@{co} E\_@{co} …;  
parameters a\_@{co} …;  
varexo …;  
@#endfor  
model;  
@#for co in countries  
Y\_@{co} = K\_@{co}^a\_@{co} \* L\_@{co}^(1-a\_@{co});  
…  
@# if co != nth\_co  
(1+i\_@{co}) = (1+i\_@{nth\_co}) \* E\_@{co}(+1) / E\_@{co}; // UIP relation  
@# else  
E\_@{co} = 1;  
@# endif  
@#endfo

---

<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:** [4 June 2021 15:02 UTC](https://forum.dynare.org/t/refer-to-specific-element-of-macro-vector/18230/2 "2021-06-04T15:02:17Z")

</div>

Use

```auto
@#define nth_co = countries[1]

```

or any index you like.

---

<div class="post-metadata">

**Author:** ![tintin\_milou](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@tintin\_milou](https://forum.dynare.org/u/tintin_milou)\
**Post date:** [4 June 2021 16:07 UTC](https://forum.dynare.org/t/refer-to-specific-element-of-macro-vector/18230/3 "2021-06-04T16:07:42Z")

</div>

> [@jpfeifer](#):
>
> `countries[1]`

Thanks! That was probably an easy question… I just couldn’t find the answer anywhere.
