There's no obvious mistake in your code. We'll need some more details to help figure where the confusion is.
Here's an example showing that your prototype is correct.
dts = {"$SAMPLE_DATA\Fitness.jmp", "$SAMPLE_DATA\Big Class.jmp"};
For( i = 1, i <= N Items( dts ), i++,
dtNext = Open( dts[i] );
Summarize( dtNext, testlist = By( :age ) );
Show( testlist );
If( Contains( testlist, "42" ),
Show( "testlist contains 42" );
, //else
Show( "testlist doesn't contain 42" )
);
);
The log:
/*:
testlist = {"38", "40", "42", "43", "44", "45", "47", "48", "49", "50", "51", "52", "54", "57"};
"testlist contains 42";
testlist = {"12", "13", "14", "15", "16", "17"};
"testlist doesn't contain 42";
-Jeff