# Error running data mod (d is not a param (or var or constraint or objective))

**URL:** <https://discuss.ampl.com/t/error-running-data-mod-d-is-not-a-param-or-var-or-constraint-or-objective/1962>\
**Category:** New to AMPL\
**Tags:** errors-and-messages\
**Created:** [October 26, 2024, 2:43am UTC](https://discuss.ampl.com/t/error-running-data-mod-d-is-not-a-param-or-var-or-constraint-or-objective/1962 "2024-10-26T02:43:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Linh\_Tran](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/linh_tran/32/856_2.png) [@Linh\_Tran](https://discuss.ampl.com/u/Linh_Tran)\
**Post date:** [October 26, 2024, 2:43am UTC](https://discuss.ampl.com/t/error-running-data-mod-d-is-not-a-param-or-var-or-constraint-or-objective/1962/1 "2024-10-26T02:43:47Z")

</div>

Hi Im running AMPL on a mac and Im trying to solve an LP model using AMPL. I keep running to this error constantly where it says: "d is not a param (or var or constraint or objective)  
context: param \>\>\> d \<\<\< := "  
My line of code for the data mod is:

```auto
param d:=
1 30
2 15
3 15
4 25
5 33
6 40
7 45
8 45
9 26
10 14
11 25
12 30;

```

and the other code for LP model:

```auto
var X{1..12} >= 0; 
var Y{1..12} >= 0;
var Z{1..12} >= 0;
param d{1..12};

minimize cost: sum{t in 1..12} (32*X[t] + 40*Y[t] + 5*Z[t]);

subj to constraint1{t in 1..12}:
	X[t] <= 30;

subj to constraint2{t in 1..12}:
	Y[t] <= 15;

subj to constraint3{t in 1..12}:
	Z[t-1] + X[t] + Y[t] = d[t] + Z[t];

subj to constraint5:
	Y[0] = 2;  

```

Please help.

---

<div class="post-metadata">

**Author:** ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)\
**Post date:** [October 27, 2024, 2:21am UTC](https://discuss.ampl.com/t/error-running-data-mod-d-is-not-a-param-or-var-or-constraint-or-objective/1962/2 "2024-10-27T02:21:29Z")

</div>

This error occurs when you try to read the data before the model. You could put the LP model code — everything from `var` `X` through the definition of `constraint5` — into a file named, say, `lp.mod`. Then you could put that data beginning with `param` `d` `:=` into a file lp.dat. Finally, you could solve the LP with the commands

```auto
model lp.mod;
data lp.dat;
solve;

```
