Variable List and Macro-language

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

You can do something like:

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:

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

Dear Sebastien,

Thank you so much for the help.

Best Regards
Sahil