@#if with "@{}" argument in @#for loop

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

@#if with "@{}" argument in @#for loop

Postby ludog » Fri Jul 18, 2014 10:26 am

Hi all,

I have a loop for in a mod file over a number countries and I would like to introduce a if with an argument depending on the country "c" but I have an error.
Relevant lines of the code will make my question clearer:

Code: Select all
@#define countries 1:2
...
...
model;
@#for c in countries
...
...
@#if rho_@{c} !=0 %(rho_@{c} is a parameter)
...
@#else
...
@#endif
...
...
@#endfor
end;


I've got the following error message:
"ERROR in macro-processor:....: Unknown variable: rho_"

It seems that @{c} is not taken into account in the argument of the if.

Do you know where the error comes from?
Thanks in advance,
L.
ludog
 
Posts: 17
Joined: Wed Nov 18, 2009 12:03 pm

Re: @#if with "@{}" argument in @#for loop

Postby jpfeifer » Fri Jul 18, 2014 12:14 pm

You cannot use the preprocessor to generate preprocessor code. This recursiveness is not allowed.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 5 guests