How to loop over variables in one model?

Hi all,
I want to loop over several variables in one model, but didn’t find any similar examples in the forum.What I see are mostly about looping over parameters or values of variables, in these cases the matlab command set_param_value is used.So I am wondering whether the set_param_value could be used in my situation,i.e.,looping over variables instead of parameters.The following codes are simplified examples as what I do, I don’t know whether the set_param_value command could be used or not. If not ,is there any other command to play the same role?

【simplified code】
// The following is in a m file

n_arr = [“variable_a”, “variable_b”,“variable_c”];
for ii=1:length(n_arr)
save variablefile n;
dynare welfare1 noclearall;

// The following is in a mod file which is named as “welfare1”

load variablefile;

My rather immature doubt: a variable is generally viewed as endogenous, i.e., conditional on other variables. So when you do this assignment, you break down the internal relations between these variables.

Sorry, I don’t understand what you mean by breaking down the internal relations. Maybe I need give more explanations for my model. In the simplified codes above, there is an endogeneous variable n in the model ,and it is used in several equations of the model.In fact the variable n is a kind of an indicator, I want to compare which indicator is better, so I need to run the same model several times for each time with one indicator representing variable n.

Is the indicator the synonym of policy instrument / tool that you want to control at the very beginning? I’m not sure whether you want to implement a Ramsey optimal policy problem?

It is a kind of policy instrument ,but not ramsey policy.HelloDynare,could you please help me solve the problem mentioned above?

Could anyone help me ? Is there any command playing the same role as set_param_value but being used for variables other than parameters?

@jpfeifer ,could you please have a look at this post? Is it possible to get rid of this kind of problem?

See my reply at Loop over variables instead of parameters in one model - #2 by jpfeifer