# Syntax error, unexpected EQUAL matlab

**URL:** <https://forum.dynare.org/t/syntax-error-unexpected-equal-matlab/5202>\
**Category:** Dynare help (legacy posts)\
**Created:** [28 December 2015 13:36 UTC](https://forum.dynare.org/t/syntax-error-unexpected-equal-matlab/5202 "2015-12-28T13:36:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![khdjabbas](https://forum.dynare.org/letter_avatar_proxy/v4/letter/k/df705f/32.png) [@khdjabbas](https://forum.dynare.org/u/khdjabbas)\
**Post date:** [28 December 2015 13:36 UTC](https://forum.dynare.org/t/syntax-error-unexpected-equal-matlab/5202/1 "2015-12-28T13:36:32Z")

</div>

I am running a Dynare model and I have a lot of equations. For one of the equations, I receive error as follows:

Starting Dynare (version 4.4.3).  
Starting preprocessing of the model file …  
ERROR: code1a.mod: line 17, col 96: syntax error, unexpected EQUAL

Error using dynare (line 174)  
DYNARE: preprocessing failed

I input all equations as given. How can I resolve this problem?

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [28 December 2015 17:55 UTC](https://forum.dynare.org/t/syntax-error-unexpected-equal-matlab/5202/2 "2015-12-28T17:55:53Z")

</div>

The error corresponds to:

```auto

```

The bracket in front of tau\_l does never close.

---

<div class="post-metadata">

**Author:** ![khdjabbas](https://forum.dynare.org/letter_avatar_proxy/v4/letter/k/df705f/32.png) [@khdjabbas](https://forum.dynare.org/u/khdjabbas)\
**Post date:** [30 December 2015 08:49 UTC](https://forum.dynare.org/t/syntax-error-unexpected-equal-matlab/5202/3 "2015-12-30T08:49:44Z")

</div>

Thanks a lot for your help 🙂 I have fixed the mistakes in my code. However I have a new error can I cannot understand. I have even used the unstable version of dynare but the problem still exists. It gives the following error:

`Reference to non-existent field 'G_hat'.
Error in read_variables (line 84)
            dyn_tmp_01 = s.(deblank(var_names_01(dyn_i_01,:)));
Error in initialize_dataset (line 32)
rawdata = read_variables(datafile,varobs,],xls.sheet,xls.range);
Error in dynare_estimation_init (line 475)
dataset_ =
initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);
Error in dynare_estimation_1 (line 81)
[dataset_,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname, ], M_, options_, oo_, estim_params_,
bayestopt_);
Error in dynare_estimation (line 89)
    dynare_estimation_1(var_list,dname);
Error in code1a (line 430)
dynare_estimation(var_list_);
Error in dynare (line 180)
evalin('base',fname) ; `

How can I resolve this issue? Kindly help me understand the error.  
Thanks,  
K  
[code1a.mod](https://forum.dynare.org/uploads/default/original/2X/c/c32825cab0f7a7476ba4f619e20f02342903716e.mod) (6.76 KB)  
[code1a\_steadystate.m](https://forum.dynare.org/uploads/default/original/2X/3/36068565191e134b3114e4caffcfc211ae7dc46c.m) (2.01 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [30 December 2015 10:47 UTC](https://forum.dynare.org/t/syntax-error-unexpected-equal-matlab/5202/4 "2015-12-30T10:47:18Z")

</div>

The datafile is missing.

---

<div class="post-metadata">

**Author:** ![khdjabbas](https://forum.dynare.org/letter_avatar_proxy/v4/letter/k/df705f/32.png) [@khdjabbas](https://forum.dynare.org/u/khdjabbas)\
**Post date:** [30 December 2015 13:25 UTC](https://forum.dynare.org/t/syntax-error-unexpected-equal-matlab/5202/5 "2015-12-30T13:25:59Z")

</div>

PFA the data file.  
[data.txt](https://forum.dynare.org/uploads/default/original/2X/a/a16c5eb78f7e8269b31afae17a2c684efa4a269d.txt) (9 KB)

---

<div class="post-metadata">

**Author:** ![khdjabbas](https://forum.dynare.org/letter_avatar_proxy/v4/letter/k/df705f/32.png) [@khdjabbas](https://forum.dynare.org/u/khdjabbas)\
**Post date:** [31 December 2015 09:48 UTC](https://forum.dynare.org/t/syntax-error-unexpected-equal-matlab/5202/6 "2015-12-31T09:48:48Z")

</div>

Okay so now I understand the problem that my variable names must be same in .mod and data file. Although I still think that G\_hat must be solved from the equation rather than the G constructed before. G\_hat needs to be calculated from this equation:

`G_hat = - rho_g*Y_hat - gamma_g*B_hat(-1) + u_g;
`

Even if I renamed my data for government spending as G\_hat; I am unable to understand why dynare is also asking for data on shocks. As per my understanding shouldn’t dynare calculate the shocks itself by solving the model?  
Now I am getting the following error:

`Reference to non-existent field 'uhat_b'.
Error in read_variables (line 84)
            dyn_tmp_01 = s.(deblank(var_names_01(dyn_i_01,:)));
Error in initialize_dataset (line 32)
rawdata = read_variables(datafile,varobs,],xls.sheet,xls.range);
Error in dynare_estimation_init (line 475)
dataset_ =
initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);
Error in dynare_estimation_1 (line 81)
[dataset_,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname, ], M_, options_, oo_, estim_params_,
bayestopt_);
Error in dynare_estimation (line 89)
    dynare_estimation_1(var_list,dname);
Error in code1a (line 430)
dynare_estimation(var_list_);
Error in dynare (line 180)
evalin('base',fname) ; `  
[code1a.mod](https://forum.dynare.org/uploads/default/original/2X/c/c32825cab0f7a7476ba4f619e20f02342903716e.mod) (6.76 KB)  
[data.txt](https://forum.dynare.org/uploads/default/original/2X/9/9b366f6028a5dd06cc11ccd00f382fec68456c93.txt) (8.85 KB)  
[code1a\_steadystate.m](https://forum.dynare.org/uploads/default/original/2X/a/a691d8f4a15f0aa95e4a9eabd7a0f7ca2fe90b56.m) (2 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [31 December 2015 10:33 UTC](https://forum.dynare.org/t/syntax-error-unexpected-equal-matlab/5202/7 "2015-12-31T10:33:53Z")

</div>

Whatever variable you specify in the varobs command needs to be in the data file. You seem to be struggling with specifying a correct observation equation. See [Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”](https://drive.google.com/file/d/1r89OU5OE3CBa6tOlj6l3hNVWEaRH5Anv/view?usp=sharing)
