Tex output - unwanted subscript "t"

If I attempt to include a model_local_variable block to define the Tex elements for those local “variables” (usually complex parameter combinations), I receive the following type of error message:

Using 64-bit preprocessor
Starting Dynare (version 4.6.4).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
terminate called after throwing an instance of ‘DataTree::UnknownLocalVariableException’

Error using dynare (line 282)
Dynare: preprocessing failed

If I comment out the model_local_variable block but change nothing else, the programme runs perfectly.

Perhaps the syntax has been changed? I give below an example (using your SW2007 model) of what I put into that model_local_variable block:

	beta      ${\beta}$
	gamma      ${\gamma}$
	PI_star      ${\pi *}$
	beta_bar      ${\bar \beta}$
	r_bar      ${\bar r}$
	C_Y		$\frac{\bar{C}}{\bar{Y}}$
	I_Y		$\frac{\bar{I}}{\bar{Y}}$
	K_Y		$\frac{\bar{K}}{\bar{Y}}$
	Z_Y		$\frac{\bar{Z}}{\bar{Y}}$
	I_K		$\frac{\bar{I}}{\bar{K}}$
	L_K		$\frac{\bar{L}}{\bar{K}}$
	WL_C		$\frac{\bar{WL}}{\bar{C}}$
	I_K_bar		$\frac{\bar{I*}}{\bar{K*}}$

Including this causes the error message quoted; deleting it the programme runs.


Could you maybe provide the full file. I cannot reproduce the problem.

One version which I have just now tested (receiving the error message "terminate called after throwing an instance of ‘DataTree::UnknownLocalVariableException’ " is attached
SW2007_4Forum.mod (21.4 KB)

I can confirm the issue and opened a ticket at Fix model_local_variable command (#1782) · Issues · Dynare / dynare · GitLab
Note that the problem appears only for some of the defined objects.

Thank you!

The bug with model_local_variable has been fixed, the fix will appear in the next Dynare release.

In the meantime, there is a workaround: in the model_local_variable statement, if you list a variable, all variables on which it depends must be listed before (in the right order).

In this case, the following statement will work:

 gammma betta clandap rkss wss ikss clk kyss iyss cyss
 wsshlc ${whlc}$

Thank you!

Hello two professors, I got a similar problem with lead of model local variables.That is , I have several model local variables, which are to be added into the model equations in the lead or lag form.
Unfortunately, Dynare stops running and gives an error warning:
ERROR: DSGE_model.mod: line 611, cols 19-27: Model local variable X_P cannot be given a lead or a lag.
Since some of the model local variables are complicated expressions, I do need the lead or lag form to simplify the expression in my model. Is there any way to solve this issue? I need your help, thank you in advance.


One possibility is to define several model local variables, one for each lead or lag form. Of course this is not ideal, since there is some duplication, but depending on your model it may still lead to a simpler model than if you were not using model local variables.

Another option is to use macroprocessor functions instead of model local variables. For example, if you have something like:

@#define f(x) = "a(" + (string) (x-1) + ")*b(" + (string) (x+1) + ")"


then the first equation will be a(1)*b(3) and the second one will be a(-2)*b(0) (i.e. the second equation is three lags behind the first one).