Previous Page | Next Page

The OPTMODEL Procedure

IN Expression

expression IN set-expression ;
expression NOT IN set-expression ;

The IN expression returns 1 if the value of the left operand is a member of the right operand set. Otherwise the IN expression returns 0. The NOT IN operator logically negates the returned value. Unlike the DATA step, the right operand is an arbitrary set expression. The left operand can be a tuple expression. The following example demonstrates the IN and NOT IN operators:

proc optmodel;
   set s = 1..10;
   put (5 in s);         /* outputs 1 */
   put (-1 not in s);    /* outputs 1 */
   set<num, str> t = {<1,'a'>, <2,'b'>, <2,'c'>};
   put (<2, 'b'> in t);   /* outputs 1 */
   put (<1, 'b'> in t);  /* outputs 0 */
Previous Page | Next Page | Top of Page