# Error defining a binary parameter in AMPL

I have to define this binary parameter in AMPL:

param h{k in K, j in Jk, t in T, r in R}; binary which equals 1 if a bus of type $$k$$ and age $$j$$ can be assigned to run $$r$$ during period $$t$$.

And I want to:

for {k in K,j in Jk}{
param h:=
[k,j,*,*]:  1   2   3:=
2020    0   1   0
2025    1   0   1
2030    0   0   1
2035    0   1   0;
}


But the output of the console gives me the following error when I print it:

Base_casenew.dat, line 40 (offset 1478):
context:  param  >>> h: <<< =


Using the assignment operator := inside the loop is redefining h for each combination of k and j, which is an error.

I assume that your actual data set will not have the same 2D data matrix for all (k, j) combinations (which is what your example here would do if it worked). You might want to look at Chapter 12 of the AMPL book, which discusses various ways for setting up multidimensional parameter data tables.