Loop over estimation command

I am trying to use Dynare’s estimation command with data from different sheets of an Excel file. Specifically, I would like to change the sheet used for each run of the estimation dynamically.

I attempted to define a variable i in a .m script to iterate through the sheets a I am trying to use Dynare’s estimation command with data from different sheets of an Excel file. Specifically, I would like to change the sheet used for each run of the estimation dynamically.

I attempted to define a variable i in a .m script to iterate through the sheets and then call Dynare with the appropriate sheet for each run, but it didn’t work

estimation( datafile=dd, xls_sheet=‘i’, …)

  1. Do you need to execute Dynare again? Then

should work.

  1. Or just run estimation? Then something along the lines of
sheet_names=sheetnames('data_fs2000.xlsx');
for iter=1:length(sheet_names)
  options_.datafile = 'data_fs2000.xlsx';
  options_.first_obs = NaN; %use first available
  options_.nobs = NaN; %use all available
  options_.xls_sheet = sheet_names(iter,:); 
  oo_recursive_=dynare_estimation(var_list_);
end

should work.
fs2000.mod (6.3 KB)
data_fs2000.xlsx (21.7 KB)