Dear all,
I am trying to compute a perfect foresight solution where I specify the values of a variable the following way
shocks;
var A;
periods 1 2 3 4;
values 1 2 3 4;
end;
This works smoothly.
Now I would like to automatize the specification of values (which in turn I read in from a matrix).
First I thought, I can use the eval, like:
eval('values 1 2 3 4;')
instead of
values 1 2 3 4;
where I created a string ‘values 1 2 3 4;’.
However, this produces an error.
Then I tried to put the whole shocks block in a string and then use eval, like:
shock_string='shocks; var A; periods 1 2 3 4; values 1 2 3 4; end;'
eval(shock_string)
but this also failed, with the message: “Error: Illegal use of reserved keyword “end””.
Is there a good way of specifying the sequence of exogenous variables automatically?
Thank you very much and many greetings