Rather than looking at spreadsheet logic (vlookup) relational algebra like SQL from databases will give you a better understanding of how GAMS looks at data:
* Declaration with artificial data
set SiteIndexS /s1*s10/,SiteIndexP /p1*p10/, SiteINdexB /b1*b10/,
Rot_Perc /r1*r10/, Ages /a1*a10/, Items /i1*i10/,
Stands /t1*t10/,Pixels /p1*p10/;
parameters
RotStandOut(SiteIndexS,SiteIndexP,SiteINdexB,Rot_Perc,Ages,Items)
PixTable(Stands,Pixels,SiteIndexS,SiteIndexP,SiteIndexB,Rot_Perc,Items);
* Fill with sparsely with ranom data
RotStandOut(SiteIndexS,SiteIndexP,SiteINdexB,Rot_Perc,Ages,Items)$(uniform(0,1)<0.005) = uniFormInt(1,10);
PixTable(Stands,Pixels,SiteIndexS,SiteIndexP,SiteIndexB,Rot_Perc,Items)$(uniform(0,1)<0.005) = uniFormInt(1,10);
* Declare indiviual index sets
set idx_RotStandOut(SiteIndexS,SiteIndexP,SiteINdexB,Rot_Perc)
idx_PixTable(SiteIndexS,SiteIndexP,SiteINdexB,Rot_Perc);
* Project relevant indexes out of the parameters
option idx_RotStandOut<idx_RotStandOut,
idx_PixTable<PixTable;
set idx(SiteIndexS,SiteIndexP,SiteINdexB,Rot_Perc);
* Build the union of the two index spaces
idx(SiteIndexS,SiteIndexP,SiteINdexB,Rot_Perc) =
idx_RotStandOut(SiteIndexS,SiteIndexP,SiteINdexB,Rot_Perc)
or idx_PixTable(SiteIndexS,SiteIndexP,SiteINdexB,Rot_Perc);
* Use the new sparse index in some calculation
Parameter maxAges(SiteIndexS,SiteIndexP,SiteINdexB,Rot_Perc,Items);
maxAges(idx,Items) = smax(Ages, RotStandOut(idx,Ages,Items))
-Michael