Felipe, it depends a bit of what you want to do it for and the number of iterations. Could you please post the current state of your *.mod and explain exactly what you want to do with and how you want to handle the results.
Best

I want to look at some statistics of variables in the model when some parameters change.

For example, I want to run the model with a specific value of beta, then change the value and compute the statistics without running it all over again.

I believe it would be something similar to this in matlab:

For a few iterations as in your example, using the Dynare macro @#for is the simplest. Dynare macros work in DynareJulia. I attach an example: CanonicalNK_loo.mod (1.2 KB)

I will also think about a Julia equivalent to your example: calling Dynare first then calling directly stoch_simul as a function

@MichelJuillard At least under Matlab/Octave that loop via the preprocessor is strongly discouraged. It does not allow for proper error handling within the loop. In case an error is triggered, you would be wrongly reading out the results from the previous iteration.