localinformant plantID[] = create (; object=set, data="Plant1 Plant2") localinformant unitID[] = create (; object=set, data="Unit1 Unit2 Unit3 Unit4 Unit5") ! map containing index value into plantID for each element of unitID to implement the mapping: ! Unit1 -> Plant1 ! Unit2 -> Plant2 ! Unit3 -> Plant1 ! Unit4 -> Plant1 ! Unit5 -> Plant2 local unitToPlantMap[uid] = create (; dataType=integer, dim=unitID, data="1 2 1 1 2") ! variable that contains commissioning years by unit id local unitComYr[uid] = create (; dim=unitID, data="1990 1975 1980 1995 2000") local pid[pid,pid] = diag (1.0; dim=plantID) local plantIDMask[uid,pid] = boolne (dimtran (pid[pid,pid]; map1=unitToPlantMap[uid], newDims=1, checkData=off),0) local unitComYrx[uid,pid] = unitComYr[uid] * plantIDMask[uid,pid] ! add offset to remove 0's before taking minimum local unitComYry[uid,pid] = booleq (unitComYrx[uid,pid],0) * 9999 + unitComYrx[uid,pid] ! variable that contains online date, which is the earliest commissioning year of the units that comprise the plant, by plant id local plantOnlineDate[pid] = coordmin (reorder (unitComYry[uid,pid]; plantID, unitID); numDims=1) table (plantOnlineDate[pid])