Hi,
I loop over some parameters (following the procedure described at dynare.org/DynareWiki/HowtoLoops) and I would like to save the results for the endogenous variables at each iteration. Is there a way to do it? (dynasave only keeps the results for the last iteration).
Otherwise, is it possible to achieve this using the macrolanguage?
I don’t know what you want to save, but it should be possible anyways.
The problem with “dynasave” is that you must give it a different filename at each iteration. This is not possible using the standard “for” loop as described on the wiki page you mention.
So you must indeed use the macro-processor in that case.
Your code could look like:
rhos = 0.8:0.05:1.05;
@#for i in 1:3
rho = rhos(@{i});
stoch_simul(order=1);
if info;
disp('Computation fails for rho = ' num2str(rho)]);
end;
dynasave savedresults@{i};
@#endfor;