AMPL is reporting “data needs 2 subscripts, not 3” because you define
set SAMPLES := 1..N;
set NAMES;
param data {SAMPLES,NAMES};
which implies that references to param data
should have 2 “subscripts”: They should be like data[i,n]
where i is a member of SAMPLES and n is a member of NAMES. You have written data[n,v,c]
which has 3 subscripts.
The other error message that you’re seeing has been discussed at at https://discuss.ampl.com/t/ampl-24919-additional-var/837