# \[AMPL 24425\] Re: syntax error in .dat

**URL:** <https://discuss.ampl.com/t/ampl-24425-re-syntax-error-in-dat/281>\
**Category:** Google Group Mirror\
**Created:** [December 18, 2022, 11:01pm UTC](https://discuss.ampl.com/t/ampl-24425-re-syntax-error-in-dat/281 "2022-12-18T23:01:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier\_Ramirez](https://avatars.discourse-cdn.com/v4/letter/j/dbc845/32.png) [@Javier\_Ramirez](https://discuss.ampl.com/u/Javier_Ramirez)\
**Post date:** [December 18, 2022, 11:01pm UTC](https://discuss.ampl.com/t/ampl-24425-re-syntax-error-in-dat/281/1 "2022-12-18T23:01:19Z")

</div>

Hi

Can you solve the syntax error?

Thanks!

---

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@AMPL\_Google\_Group](https://discuss.ampl.com/u/AMPL_Google_Group)\
**Post date:** [December 19, 2022, 6:45pm UTC](https://discuss.ampl.com/t/ampl-24425-re-syntax-error-in-dat/281/2 "2022-12-19T18:45:43Z")

</div>

The data for a scalar parameter (like T, Beta, or epsilon in the example) can be given in the model. But data for an indexed parameter, like D, has to be given separately from the definition of the parameter. Usually there is a model file that specifies, say,

```auto
param T := 4;
param Beta := 0.95;
param epsilon := 0.1;
param D {1..T};

```

Then in a data file, the values for the indexed parameter are given:

```auto
param D :=
1 60
2 83
3 91
4 83
;

```

The model file is read with a _model_ statement, and the data file is read with a _data_ statement, as in this example:

```auto
model test.mod;
data test.dat;

```

Alternatively, if you want to put everything in test.mod, just put a _data_ statement without a filename before the data:

```auto
param T := 4;
param Beta := 0.95;
param epsilon := 0.1;
param D {1..T};

data;

param D :=
1 60
2 83
3 91
4 83
;

```

(The data for the scalar parameters can also be given in the data file rather than in the model, if that is convenient.)
