Add model_local_variable declaration for declaring model local variables with tex names
Manually cherry-picked from 628c4cf27b
.
time-shift
parent
a087d59509
commit
9288d5142c
|
@ -33,7 +33,7 @@ class DynareLexer(RegexLexer):
|
||||||
filenames = ['*.mod']
|
filenames = ['*.mod']
|
||||||
|
|
||||||
commands = (
|
commands = (
|
||||||
"dynare","var","varexo","varexo_det","parameters","change_type",
|
"dynare","var","varexo","varexo_det","parameters","change_type","model_local_variable",
|
||||||
"predetermined_variables","trend_var","log_trend_var","external_function",
|
"predetermined_variables","trend_var","log_trend_var","external_function",
|
||||||
"write_latex_original_model","write_latex_dynamic_model",
|
"write_latex_original_model","write_latex_dynamic_model",
|
||||||
"write_latex_static_model","resid","initval_file","histval_file","dsample",
|
"write_latex_static_model","resid","initval_file","histval_file","dsample",
|
||||||
|
|
|
@ -376,6 +376,8 @@ for declaring variables and parameters are described below.
|
||||||
|
|
||||||
*Example*
|
*Example*
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
trend_var (growth_factor=gA) A;
|
trend_var (growth_factor=gA) A;
|
||||||
|
|
||||||
|
|
||||||
|
@ -386,6 +388,21 @@ for declaring variables and parameters are described below.
|
||||||
the log of a variable with a multiplicative trend).
|
the log of a variable with a multiplicative trend).
|
||||||
|
|
||||||
|
|
||||||
|
.. command:: model_local_variable VARIABLE_NAME [LATEX_NAME]... ;
|
||||||
|
|
||||||
|
This optional command declares a model local variable. See
|
||||||
|
:ref:`conv` for the syntax of VARIABLE_NAME. As you can create
|
||||||
|
model local variables on the fly in the model block (see
|
||||||
|
:ref:`model-decl`), the interest of this command is primarily to
|
||||||
|
assign a LATEX_NAME to the model local variable.
|
||||||
|
|
||||||
|
*Example*
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
model_local_variable GDP_US $GDPUS$;
|
||||||
|
|
||||||
|
|
||||||
.. _expr:
|
.. _expr:
|
||||||
|
|
||||||
Expressions
|
Expressions
|
||||||
|
@ -750,17 +767,20 @@ The model is declared inside a ``model`` block:
|
||||||
|
|
||||||
MODEL_EXPRESSION;
|
MODEL_EXPRESSION;
|
||||||
|
|
||||||
|br| Inside the model block, Dynare allows the creation of *model-local
|
|br| Inside the model block, Dynare allows the creation of
|
||||||
variables*, which constitute a simple way to share a common
|
*model-local variables*, which constitute a simple way to share a
|
||||||
expression between several equations. The syntax consists of a
|
common expression between several equations. The syntax consists
|
||||||
pound sign (#) followed by the name of the new model local
|
of a pound sign (#) followed by the name of the new model local
|
||||||
variable (which must **not** be declared as in :ref:`var-decl`),
|
variable (which must **not** be declared as in :ref:`var-decl`,
|
||||||
an equal sign, and the expression for which this new variable will
|
but may have been declared by :comm:`model_local_variable`), an
|
||||||
|
equal sign, and the expression for which this new variable will
|
||||||
stand. Later on, every time this variable appears in the model,
|
stand. Later on, every time this variable appears in the model,
|
||||||
Dynare will substitute it by the expression assigned to the
|
Dynare will substitute it by the expression assigned to the
|
||||||
variable. Note that the scope of this variable is restricted to
|
variable. Note that the scope of this variable is restricted to
|
||||||
the model block; it cannot be used outside. A model local variable
|
the model block; it cannot be used outside. To assign a LaTeX name
|
||||||
declaration looks like:
|
to the model local variable, use the declaration syntax outlined
|
||||||
|
by :comm:`model_local_variable`. A model local variable declaration
|
||||||
|
looks like:
|
||||||
|
|
||||||
#VARIABLE_NAME = MODEL_EXPRESSION;
|
#VARIABLE_NAME = MODEL_EXPRESSION;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue