set_y = Associative Array( {"chair", "person", "relay", "snake", "tripod"} );

set_z = Associative Array( {"person", "snake"} );

set_w = Associative Array( {"apple", "orange"} );

`// write the sets to the log`

`Write(`

"\!NExample:\!N\!tset_y = ",

set_y << Get Keys,

"\!N\!tset_z = ",

set_z << Get Keys,

"\!N\!tset_w = ",

set_w << Get Keys

);

Example:

set_y = {"chair", "person", "relay", "snake", "tripod"}

set_z = {"person", "snake"}

set_w = {"apple", "orange"}

set_z << Insert( set_w );

Write( "\!N\!NUnion operation (set_w, set_z):,\!N\!tset_z = ", set_z << Get Keys );

Union operation (set_w, set_z):,

set_z = {"apple", "orange", "person", "snake"}

set_y << Remove( set_z );

Write( "\!N\!NDifference operation (set_z from set_y):\!N\!tset_y = ", set_y << Get Keys );

Difference operation (set_z from set_y):

set_y = {"chair", "relay", "tripod"}

To find the intersection of two sets, use the aa << Intersect message.

set_w << Intersect( set_z );

Write( "\!N\!NIntersect operation (set_w, set_z):\!N\!tset_w = ", set_w << Get Keys );

Intersect operation (set_w, set_z):

set_w = {"apple", "orange"}

Given a list of names, which of them are not contained in Big Class.jmp? You can find the answer by taking the difference of the two sets of names.

names list = {"ROBERT", "JEFF", "CHRIS", "HARRY"};

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

names = Associative Array( names list );

names << Remove( Associative Array( dt:name ) );

Write( "\!NWhich of {ROBERT, JEFF, CHRIS, HARRY}, is not in Big Class = ", names << Get Keys );

Which of {ROBERT, JEFF, CHRIS, HARRY}, is not in Big Class = {"HARRY", "JEFF"}