diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 6da7c765615d3096ecc93ae3aa9a34dd19ed9759..aa151b56b582c10d7e1662df6d1b23e196356204 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -3708,6 +3708,21 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
                  << modstruct << "pac." << substruct << "non_optimizing_behaviour.vars = [";
           for (auto & it : non_optim_vars_params_and_constants)
             output << symbol_table.getTypeSpecificID(get<0>(it)) + 1 << " ";
+          output << "];" << endl
+                 << modstruct << "pac." << substruct << "non_optimizing_behaviour.type = [";
+          for (auto & it : non_optim_vars_params_and_constants)
+            switch (symbol_table.getType(get<0>(it)))
+              {
+              case SymbolType::endogenous:
+                output << "1 ";
+                break;
+              case SymbolType::exogenous:
+                output << "0 ";
+                break;
+              default:
+                cerr << "expecting endogenous or exogenous" << endl;
+                exit(EXIT_FAILURE);
+              }
           output << "];" << endl
                  << modstruct << "pac." << substruct << "non_optimizing_behaviour.lags = [";
           for (auto & it : non_optim_vars_params_and_constants)