<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Formula to check if any of a list of items is contained in the rows of a column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810290#M99255</link>
    <description>&lt;P&gt;I think it's worth adding that the Where() function is much faster&amp;nbsp;(&amp;gt; an order of magnitude!) than &amp;lt;&amp;lt;Select Where or &amp;lt;&amp;lt;Get Rows Where.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
dt = Data Table( "SATByYear" );
Show( N Rows( dt ) );		//N Rows(dt) = 21245376;
now = HP Time();
dt &amp;lt;&amp;lt; Select Where( :State == "Wisconsin" | :State == "Alabama" );
Wait( 0 );
total = HP Time() - now;
Print( "&amp;lt;&amp;lt;Select Where took " || Char( total / 1e6 ) || " seconds." );		//"&amp;lt;&amp;lt;Select Where took 3.241594 seconds."
dt &amp;lt;&amp;lt; Clear Select;
now = HP Time();
wh = Where( dt, :State == "Wisconsin" | :State == "Alabama" );
dt &amp;lt;&amp;lt; Select Rows( wh );
Wait( 0 );
total = HP Time() - now;
Print( "Where() took " || Char( total / 1e6 ) || " seconds." );		//"Where() took 0.284793 seconds."
dt &amp;lt;&amp;lt; Clear Select;
now = HP Time();
wh = dt &amp;lt;&amp;lt; Get Rows Where( dt, :State == "Wisconsin" | :State == "Alabama" );
dt &amp;lt;&amp;lt; Select Rows( wh );
Wait( 0 );
total = HP Time() - now;
Print( "&amp;lt;&amp;lt;Get Rows Where took " || Char( total / 1e6 ) || " seconds." );		//"&amp;lt;&amp;lt;Get Rows Where took 7.059092 seconds."&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Nov 2024 13:59:07 GMT</pubDate>
    <dc:creator>mmarchandFSLR</dc:creator>
    <dc:date>2024-11-11T13:59:07Z</dc:date>
    <item>
      <title>Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810200#M99208</link>
      <description>&lt;P&gt;JMP for Mac&amp;nbsp;&lt;/P&gt;&lt;P&gt;Version 17.2.0 (701896)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a column "Data" with rows of number_number like this:&lt;/P&gt;&lt;P&gt;1_3&lt;/P&gt;&lt;P&gt;3_7&lt;/P&gt;&lt;P&gt;6_5&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to test this column to see if some of the rows contain values from a list of values and then flag or label the rows which do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know I could construct an elaborate formula like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :Die X_Y == "3_9" | :Die X_Y == "3_4",
	1,
	0
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But that's very laborious for long lists of different values to check. &amp;nbsp;I'd like to just be able to paste a list of values to check for in a formula, delimited by a space or comma. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found the function "&lt;A href="https://www.jmp.com/support/help/en/17.2/index.shtml#page/jmp/character-functions-2.shtml" target="_self"&gt;Contains Item&lt;/A&gt;." &amp;nbsp;It works fine for one item but the help entry doesn't offer any insight on how to construct the "list" option. &amp;nbsp;I tried this (specifying the optional delimiter as a space):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Contains Item( :Die X_Y, "3_4 3_9", " " ),
	"exclude",
	"not exclude"
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Contains Item( :Data, "3_4,3_9", "," ),
	"exclude",
	"not exclude"
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I understand the default delimiter is a comma but wanted to enforce to find anything that works. &amp;nbsp;Neither Contains Item function is returning the sought-for behavior (logical 1 if there is a match, 0 if not). &amp;nbsp;If there is a better function to use please advise. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a generalized problem I'd like to be able to solve -- inspecting a column to find matches with long lists of items. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Nov 2024 13:30:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810200#M99208</guid>
      <dc:creator>datanaut</dc:creator>
      <dc:date>2024-11-09T13:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810201#M99209</link>
      <description>&lt;P&gt;Here is the approach I would take&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();

dt &amp;lt;&amp;lt; clear select;

find = {"3_1","4_4"};

for each( {compare}, find,
	dt&amp;lt;&amp;lt;select where( dt:Die X_Y == compare, current selection("Extend"));
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Once the rows are selected, then excluding, deleting etc. can be done.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Nov 2024 14:44:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810201#M99209</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-11-09T14:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810205#M99210</link>
      <description>&lt;P&gt;Usually in cases like this I tend to use Words() to split the string into a list and then compare using Contains() (or in some rare cases Contains Item()). But Contains Item() should also work and you just seem to have your parameters in incorrect order&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table("Untitled",
	Add Rows(3),
	Compress File When Saved(1),
	New Column("Column 1", Character, "Nominal", Set Values({"1_3", "3_7", "6_5"})),
	New Column("Column 2",
		Character,
		"Nominal",
		Formula(
			If(Contains Item("1_3 3_9", :Column 1, " "),
				"exclude",
				"not exclude"
			)
		),
		Set Selected
	)
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1731165057018.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69998i2CF339F64E748A67/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1731165057018.png" alt="jthi_0-1731165057018.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Second example from Scripting Index&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1731165235628.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69999iA84B197CAF014387/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1731165235628.png" alt="jthi_1-1731165235628.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1731165277236.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70000i70FDF9BF6918DBDD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1731165277236.png" alt="jthi_2-1731165277236.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;or JSL Syntax Reference have okeish examples &lt;A href="https://www.jmp.com/support/help/en/18.0/#page/jmp/character-functions-2.shtml?os=win&amp;amp;source=application#ww6166335" target="_blank"&gt;https://www.jmp.com/support/help/en/18.0/#page/jmp/character-functions-2.shtml?os=win&amp;amp;source=application#ww6166335&lt;/A&gt; but the documentation is bit lacking. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Nov 2024 15:17:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810205#M99210</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-11-09T15:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810214#M99212</link>
      <description>&lt;P&gt;I did some timing tests comparing Jarmo's solution compared to my solution, and the Contains Item solution is spectacularly faster than the Select Where solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Nov 2024 17:53:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810214#M99212</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-11-09T17:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810225#M99219</link>
      <description>&lt;P&gt;-&lt;/P&gt;</description>
      <pubDate>Sat, 09 Aug 2025 15:29:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810225#M99219</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-08-09T15:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810228#M99220</link>
      <description>&lt;P&gt;added it to&amp;nbsp;&lt;LI-MESSAGE title="Tips and Tricks - best practice with JMP/JSL" uid="662686" url="https://community.jmp.com/t5/Discussions/Tips-and-Tricks-best-practice-with-JMP-JSL/m-p/662686#U662686" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1731241802910.png" style="width: 684px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70011iB71AF709F9A7735D/image-dimensions/684x93?v=v2" width="684" height="93" role="button" title="hogi_0-1731241802910.png" alt="hogi_0-1731241802910.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Aug 2025 15:29:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810228#M99220</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-08-09T15:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810248#M99234</link>
      <description>&lt;OL&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;Contains item()&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is faster with&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;'s&amp;nbsp; syntax - v2 is slower&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;Select where()&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;gets much faster by replacing it with&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;get rows where() + select rows().&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;Select Where()&lt;/FONT&gt;&amp;nbsp;gets significantly (!!) faster by replacing the string comparison with the&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;contains item()&lt;/FONT&gt;.&lt;/LI&gt;
&lt;LI&gt;combining (2)&amp;nbsp;and (3) is quite comparable&lt;/LI&gt;
&lt;LI&gt;... also for larger data sets.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1731261697022.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70017i3B687F3FACA86149/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1731261697022.png" alt="hogi_0-1731261697022.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = Open( "$SAMPLE_DATA/Wafer Stacked.jmp" );

New Column( "x_y",
	Character,
	Formula( Concat Items( {Char( :X_Die ), Char( :Y_Die )}, "_" ) )
);

wait(0);

t0=hptime();
New Column( "contains item",
	Character,
	Formula( If( Contains Item( "1_3 3_9", :x_y, " " ), "exclude", "not exclude" ) )
);
dt &amp;lt;&amp;lt; run formulas();
t= (hptime()-t0)/1000000;
print("formula - contains item", t);



t0=hptime();
New Column( "contains item v2",
	Character,
	Formula( If( Contains Item( :x_y, {"3_1","4_4"}) , "exclude", "not exclude" ) )
);
dt &amp;lt;&amp;lt; run formulas();
t= (hptime()-t0)/1000000;
print("1) formula - contains item v2", t);




t0=hptime();
New Column( "get rows where",
	Character,
	set each value("not excluded") );
myrows=[];
for each( {compare}, {"3_1","4_4"},	
	myrows = V concat to (myrows,  dt &amp;lt;&amp;lt; get rows where(:x_y == compare));	
);
dt &amp;lt;&amp;lt; select rows(myrows); // just for fun - it's fast
dt[myrows,"get rows where"] = Repeat({"excluded"},n items(myrows) );
t= (hptime()-t0)/1000000;
print("2) get rows where", t);



t0=hptime();
for each( {compare}, {"3_1","4_4"},
	dt&amp;lt;&amp;lt;select where( dt:X_Y == compare, current selection("Extend"));
);
t= (hptime()-t0)/1000000;
print("select where - extend", t);



t0=hptime();
for each( {compare}, {"3_1","4_4"},
	dt&amp;lt;&amp;lt;select where( dt:X_Y == compare);
);
t= (hptime()-t0)/1000000;
print("select where", t);



t0=hptime();
New Column( "select where + contains item",
	Character,
	set each value("not excluded") );
dt&amp;lt;&amp;lt;select where( Contains Item( "1_3 3_9", :x_y, " " ));
myrows = dt &amp;lt;&amp;lt; get selected rows ();
dt[myrows,"select where + contains item"] = Repeat({"excluded"},n items(myrows) );
t= (hptime()-t0)/1000000;
print("3) select where + contains item (v1)", t);





t0=hptime();
New Column( "get rows where &amp;amp; contains item",
	Character,
	set each value("not excluded") );
myrows = dt &amp;lt;&amp;lt; get rows where(Contains Item( "1_3 3_9", :x_y, " " ));	
dt[myrows,"get rows where &amp;amp; contains item"] = Repeat({"excluded"},n items(myrows) );
t= (hptime()-t0)/1000000;
print("4) get rows where + contains item (v1)", t);&lt;/CODE&gt;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1731305493836.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70019i116F7A07829AD82B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1731305493836.png" alt="hogi_0-1731305493836.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Aug 2025 15:30:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810248#M99234</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-08-09T15:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810290#M99255</link>
      <description>&lt;P&gt;I think it's worth adding that the Where() function is much faster&amp;nbsp;(&amp;gt; an order of magnitude!) than &amp;lt;&amp;lt;Select Where or &amp;lt;&amp;lt;Get Rows Where.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
dt = Data Table( "SATByYear" );
Show( N Rows( dt ) );		//N Rows(dt) = 21245376;
now = HP Time();
dt &amp;lt;&amp;lt; Select Where( :State == "Wisconsin" | :State == "Alabama" );
Wait( 0 );
total = HP Time() - now;
Print( "&amp;lt;&amp;lt;Select Where took " || Char( total / 1e6 ) || " seconds." );		//"&amp;lt;&amp;lt;Select Where took 3.241594 seconds."
dt &amp;lt;&amp;lt; Clear Select;
now = HP Time();
wh = Where( dt, :State == "Wisconsin" | :State == "Alabama" );
dt &amp;lt;&amp;lt; Select Rows( wh );
Wait( 0 );
total = HP Time() - now;
Print( "Where() took " || Char( total / 1e6 ) || " seconds." );		//"Where() took 0.284793 seconds."
dt &amp;lt;&amp;lt; Clear Select;
now = HP Time();
wh = dt &amp;lt;&amp;lt; Get Rows Where( dt, :State == "Wisconsin" | :State == "Alabama" );
dt &amp;lt;&amp;lt; Select Rows( wh );
Wait( 0 );
total = HP Time() - now;
Print( "&amp;lt;&amp;lt;Get Rows Where took " || Char( total / 1e6 ) || " seconds." );		//"&amp;lt;&amp;lt;Get Rows Where took 7.059092 seconds."&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Nov 2024 13:59:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810290#M99255</guid>
      <dc:creator>mmarchandFSLR</dc:creator>
      <dc:date>2024-11-11T13:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810318#M99266</link>
      <description>&lt;P&gt;Ah, great!&lt;BR /&gt;&lt;BR /&gt;In the beginning I had quite bad experience with &lt;FONT face="courier new,courier"&gt;Where()&lt;/FONT&gt; - but cannot remember why. *)&lt;BR /&gt;Maybe I used a wrong syntax - or the issue got fixed in the mean time ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*) edit:&lt;BR /&gt;bad experience: doesn't work with &lt;FONT face="courier new,courier"&gt;contains()&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Dec 2025 07:06:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810318#M99266</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-12-03T07:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810361#M99286</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26800"&gt;@hogi&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/58003"&gt;@mmarchandFSLR&lt;/a&gt;&amp;nbsp;for answers and effort to my question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jarmo found my problem -- switching the list and item in my formula. &amp;nbsp;Thanks for the bit of code illustrating the correct usage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;re: "Documentation a bit lacking"&lt;BR /&gt;I concur. &amp;nbsp;The instructions and example in the scripting index do seem a little ambiguous to me. &amp;nbsp;Here is the entry for the scripting index:&lt;BR /&gt;&lt;BR /&gt;"&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Contains Item&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;x&lt;/SPAN&gt;&lt;SPAN&gt;, &amp;lt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;item&lt;/SPAN&gt;&lt;SPAN&gt; | {&lt;/SPAN&gt;&lt;SPAN class=""&gt;list&lt;/SPAN&gt;&lt;SPAN&gt;} | &lt;/SPAN&gt;&lt;SPAN class=""&gt;pattern&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;, &amp;lt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;delimiter&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;Returns a Boolean that indicates whether the word (&lt;SPAN class=""&gt;item&lt;/SPAN&gt;), one of a list of words (&lt;SPAN class=""&gt;list&lt;/SPAN&gt;), or pattern (&lt;SPAN class=""&gt;pattern&lt;/SPAN&gt;) matches one of the words in the text represented by &lt;SPAN class=""&gt;x&lt;/SPAN&gt;. Words are delimited by the characters in the optional quoted delimiter (&lt;SPAN class=""&gt;delimiter&lt;/SPAN&gt;) string. A comma is the default delimiter. Blanks are trimmed from the ends of each extracted word from the input text string (&lt;SPAN class=""&gt;x&lt;/SPAN&gt;).&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So (to my simplistic reading) either x or the {list} could contain the words to be searched or the list of words to compare it with. &amp;nbsp;A few more examples showing some alternatives that included a Column as in Jarmo's example might help clarify. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've put the solution to use already! &amp;nbsp;Thanks again.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 21:56:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810361#M99286</guid>
      <dc:creator>datanaut</dc:creator>
      <dc:date>2024-11-11T21:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810364#M99288</link>
      <description>&lt;P&gt;the reading is: 3 arguments&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;x - a string of characters&lt;/LI&gt;
&lt;LI&gt;3 options:&lt;BR /&gt;- item to search&lt;BR /&gt;- a list of several items - does one of them match?&lt;BR /&gt;- a pattern to search&lt;/LI&gt;
&lt;LI&gt;optional argument: the delimiter to split x in words&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/12282"&gt;@datanaut&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So (to my simplistic reading) either x or the {list} could contain the words to be searched or the list of words to compare it with.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;-&amp;gt; yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&amp;nbsp;included a Column as in Jarmo's example&amp;nbsp;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For a column formula, this is always possible, along the idea:&lt;BR /&gt;For every row, JMP will take automatically the entry of the column in the respective row.&lt;BR /&gt;When you use Formula editor, you do this trick all the time - just without noting.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Dec 2025 07:03:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810364#M99288</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-12-03T07:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810365#M99289</link>
      <description>&lt;P&gt;A nice side effect:&lt;BR /&gt;&lt;BR /&gt;This discussion made me think: &lt;BR /&gt;does&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Contains&lt;/FONT&gt;&amp;nbsp;also increase the speed of &lt;FONT face="courier new,courier"&gt;Col ..&lt;/FONT&gt; aggregations?&lt;/P&gt;
&lt;P&gt;And believe it or not - it does. wow, it does!!!!&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/How-do-I-use-the-Col-Maximum-Formula-with-a-quot-where-quot/m-p/810363/highlight/true#M99287" target="_blank" rel="noopener"&gt;https://community.jmp.com/t5/Discussions/How-do-I-use-the-Col-Maximum-Formula-with-a-quot-where-quot/m-p/810363/highlight/true#M99287&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any clue why the character comparison is SOOO slow?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2025 05:25:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/810365#M99289</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-08-08T05:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/916362#M107677</link>
      <description>&lt;P&gt;I wondered if deleting rows without selecting them is much faster:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; select rows(myRows) &amp;lt;&amp;lt; delete rows();
dt &amp;lt;&amp;lt; delete rows();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;[actually, I wondered why the corresponding &lt;FONT face="courier new,courier"&gt;&amp;lt;&amp;lt; exclude(myRows)&lt;/FONT&gt; is missing.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, here is another speed test:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to here(1);
get timing = Function( {myExpr},
	dt = New Table( "test", add rows( 10000000 ), New Column( "rnd", set each value( Random Integer( 1000 ) ) ) );
	myRows = Random Shuffle( Index( 1, N Rows() ) )[Index( 1, N Rows() / 2 )];
	t0 = HP Time();
	myExpr;
//print(n rows()); // same timing without this line
	If( N arg( myExpr ) &amp;gt; 2,
		Print( Char( Head( Arg( myExpr, 2 ) ) ) || " + " || Char( Head( Arg( myExpr, 3 ) ) ) ),
		Print( Char( Head( Arg( myExpr, 2 ) ) ) );
	);
	Print( Char( (HP Time() - t0) / 1000000 ) || " s\!n" );
	Close( dt, noSave );
);

get timing( Expr( dt &amp;lt;&amp;lt; select rows( myRows ) &amp;lt;&amp;lt; delete rows ) );

get timing( Expr( dt &amp;lt;&amp;lt; delete rows( myRows ) ) );

get timing( Expr( dt &amp;lt;&amp;lt; select rows( myRows ) &amp;lt;&amp;lt; exclude( 1 ) ) );

Print("-------------");

get timing( Expr( dt &amp;lt;&amp;lt; select where( :rnd &amp;gt; 500 ) ) );

get timing( Expr( dt &amp;lt;&amp;lt; get rows where( :rnd &amp;gt; 500 ) ) );

get timing( Expr( myRows = Where( dt, :rnd &amp;gt; 500 ) ) );

Print("_____________");
	
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1764746400738.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/88140iDBB3DCFC9D4EF8A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1764746400738.png" alt="hogi_1-1764746400738.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So,&amp;nbsp; deleting rows without selecting them is just marginally faster.&lt;BR /&gt;-&amp;gt; no wonder there is no corresponding function for Exclude.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Dec 2025 07:29:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/916362#M107677</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-12-03T07:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/916364#M107678</link>
      <description>&lt;P&gt;by the way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Print("_________");
Print("__X______");
Print("X________");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_2-1764747078244.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/88144iE0D065307C07B6D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_2-1764747078244.png" alt="hogi_2-1764747078244.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;why?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Dec 2025 07:32:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/916364#M107678</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-12-03T07:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/916368#M107680</link>
      <description>&lt;P&gt;My guess is that Print is doing some parsing/evaluations as it is meant to be used for displaying values of arguments. And when you start -"variable" with two underscores it is considered hidden -&amp;gt; possibly some interaction with Print() to not make it leak those values.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Dec 2025 07:46:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/916368#M107680</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-12-03T07:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to check if any of a list of items is contained in the rows of a column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/916377#M107681</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;show("__");
myString="__";
show(myString);
show("_"|| "_");

__x="secret";
show(__x);
show(name Expr(__x));
show(Eval(__x));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1764749234016.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/88147i0E2282E8CD016330/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1764749234016.png" alt="hogi_0-1764749234016.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a second layer of ulra-tight protection ; )&lt;/P&gt;</description>
      <pubDate>Wed, 03 Dec 2025 08:08:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-check-if-any-of-a-list-of-items-is-contained-in-the/m-p/916377#M107681</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-12-03T08:08:52Z</dc:date>
    </item>
  </channel>
</rss>

