First create a SAS data set as follows: data indata; input k i; datalines; 1 1 1 2 1 5 2 3 2 7 3 4 3 6 3 8 3 9 ; In PROC OPTMODEL, you can read these pairs like this: set <num,num> KI; read data indata into KI=[k i]; One approach to express the desired constraint is to use an implicit slice: set KSET = setof {<k,i> in KI} k; con Mycon {k in KSET}: sum {<(k),i> in KI, j in Pages} BlockSize * BlockAssign[i,j] <= MaxDivPrntArea ; If you insist on using DivBlocks, here is an alternative approach that uses the SETOF operator again: set DivBlocks {k in KSET} = setof {<(k),i> in KI} i; con Mycon {k in KSET}: sum {i in DivBlocks , j in Pages} BlockSize * BlockAssign[i,j] <= MaxDivPrntArea ; A third approach passes through the KI set only once to construct both KSET and DivBlocks: set KSET init {}; set DivBlocks {KSET} init {}; for {<k,i> in KI} do; KSET = KSET union {k}; DivBlocks = DivBlocks union {i}; end; con Mycon {k in KSET}: sum {i in DivBlocks , j in Pages} BlockSize * BlockAssign[i,j] <= MaxDivPrntArea ; The doc link referenced in my previous reply contains numerous relevant examples. Search for "sets indexed by other sets" in the pdf.
... View more