cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-810200%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EFormula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810200%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EJMP%20for%20Mac%26nbsp%3B%3C%2FP%3E%3CP%3EVersion%2017.2.0%20(701896)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20column%20%22Data%22%20with%20rows%20of%20number_number%20like%20this%3A%3C%2FP%3E%3CP%3E1_3%3C%2FP%3E%3CP%3E3_7%3C%2FP%3E%3CP%3E6_5%3C%2FP%3E%3CP%3E...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20test%20this%20column%20to%20see%20if%20some%20of%20the%20rows%20contain%20values%20from%20a%20list%20of%20values%20and%20then%20flag%20or%20label%20the%20rows%20which%20do.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20know%20I%20could%20construct%20an%20elaborate%20formula%20like%20this%3A%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EIf(%20%3ADie%20X_Y%20%3D%3D%20%223_9%22%20%7C%20%3ADie%20X_Y%20%3D%3D%20%223_4%22%2C%0A%091%2C%0A%090%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EBut%20that's%20very%20laborious%20for%20long%20lists%20of%20different%20values%20to%20check.%20%26nbsp%3BI'd%20like%20to%20just%20be%20able%20to%20paste%20a%20list%20of%20values%20to%20check%20for%20in%20a%20formula%2C%20delimited%20by%20a%20space%20or%20comma.%20%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20found%20the%20function%20%22%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F17.2%2Findex.shtml%23page%2Fjmp%2Fcharacter-functions-2.shtml%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EContains%20Item%3C%2FA%3E.%22%20%26nbsp%3BIt%20works%20fine%20for%20one%20item%20but%20the%20help%20entry%20doesn't%20offer%20any%20insight%20on%20how%20to%20construct%20the%20%22list%22%20option.%20%26nbsp%3BI%20tried%20this%20(specifying%20the%20optional%20delimiter%20as%20a%20space)%3A%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EIf(%20Contains%20Item(%20%3ADie%20X_Y%2C%20%223_4%203_9%22%2C%20%22%20%22%20)%2C%0A%09%22exclude%22%2C%0A%09%22not%20exclude%22%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Eand%20this%3A%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EIf(%20Contains%20Item(%20%3AData%2C%20%223_4%2C3_9%22%2C%20%22%2C%22%20)%2C%0A%09%22exclude%22%2C%0A%09%22not%20exclude%22%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EI%20understand%20the%20default%20delimiter%20is%20a%20comma%20but%20wanted%20to%20enforce%20to%20find%20anything%20that%20works.%20%26nbsp%3BNeither%20Contains%20Item%20function%20is%20returning%20the%20sought-for%20behavior%20(logical%201%20if%20there%20is%20a%20match%2C%200%20if%20not).%20%26nbsp%3BIf%20there%20is%20a%20better%20function%20to%20use%20please%20advise.%20%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20a%20generalized%20problem%20I'd%20like%20to%20be%20able%20to%20solve%20--%20inspecting%20a%20column%20to%20find%20matches%20with%20long%20lists%20of%20items.%20%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-810200%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAutomation%20and%20Scripting%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EmacOS%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810365%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810365%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3EA%20nice%20side%20effect%3A%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20discussion%20made%20me%20think%3A%20%3CBR%20%2F%3Edoes%26nbsp%3B%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3EContains%3C%2FFONT%3E%26nbsp%3Balso%20increase%20the%20speed%20of%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3ECol%20..%3C%2FFONT%3E%20aggregations%3F%3C%2FP%3E%0A%3CP%3EAnd%20believe%20it%20or%20not%20-%20it%20does.%20wow%2C%20it%20does!!!!%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FDiscussions%2FHow-do-I-use-the-Col-Maximum-Formula-with-a-quot-where-quot%2Fm-p%2F810363%2Fhighlight%2Ftrue%23M99287%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.jmp.com%2Ft5%2FDiscussions%2FHow-do-I-use-the-Col-Maximum-Formula-with-a-quot-where-quot%2Fm-p%2F810363%2Fhighlight%2Ftrue%23M99287%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAny%20clue%20why%20the%20character%20comparison%20is%20SOOO%20slow%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810364%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810364%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ethe%20reading%20is%3A%203%20arguments%3C%2FP%3E%3COL%3E%3CLI%3Ex%20-%20a%20string%20of%20characters%3C%2FLI%3E%3CLI%3E3%20options%3A%3CBR%20%2F%3E-%20item%20to%20search%3CBR%20%2F%3E-%20a%20list%20of%20several%20items%20-%20does%20one%20of%20hem%20match%3CBR%20%2F%3E-%20a%20pattern%20to%20search%3C%2FLI%3E%3CLI%3Eoptional%20argument%3A%20the%20delimiter%20to%20split%20x%20in%20words%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F12282%22%20target%3D%22_blank%22%3E%40datanaut%3C%2FA%3E%26nbsp%3Bwrote%3A%3CBR%20%2F%3E%3CP%3ESo%20(to%20my%20simplistic%20reading)%20either%20x%20or%20the%20%7Blist%7D%20could%20contain%20the%20words%20to%20be%20searched%20or%20the%20list%20of%20words%20to%20compare%20it%20with.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3E-%26gt%3B%20yes.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%26nbsp%3Bincluded%20a%20Column%20as%20in%20Jarmo's%20example%26nbsp%3B%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3EFor%20a%20column%20formula%2C%20this%20is%20always%20possible%2C%20along%20the%20idea%3A%3CBR%20%2F%3EFor%20every%20row%2C%20JMP%20will%20take%20automatically%20the%20entry%20of%20the%20column%20in%20the%20respective%20row.%3CBR%20%2F%3EWhen%20you%20use%20Formula%20editor%2C%20you%20do%20this%20trick%20all%20the%20time%20-%20just%20without%20noting.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810361%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810361%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F14366%22%20target%3D%22_blank%22%3E%40jthi%3C%2FA%3E%26nbsp%3Band%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2687%22%20target%3D%22_blank%22%3E%40txnelson%3C%2FA%3E%26nbsp%3Band%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F26800%22%20target%3D%22_blank%22%3E%40hogi%3C%2FA%3E%26nbsp%3Band%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58003%22%20target%3D%22_blank%22%3E%40mmarchandFSLR%3C%2FA%3E%26nbsp%3Bfor%20answers%20and%20effort%20to%20my%20question.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJarmo%20found%20my%20problem%20--%20switching%20the%20list%20and%20item%20in%20my%20formula.%20%26nbsp%3BThanks%20for%20the%20bit%20of%20code%20illustrating%20the%20correct%20usage.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ere%3A%20%22Documentation%20a%20bit%20lacking%22%3CBR%20%2F%3EI%20concur.%20%26nbsp%3BThe%20instructions%20and%20example%20in%20the%20scripting%20index%20do%20seem%20a%20little%20ambiguous%20to%20me.%20%26nbsp%3BHere%20is%20the%20entry%20for%20the%20scripting%20index%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%22%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3EContains%20Item%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Ex%3C%2FSPAN%3E%3CSPAN%3E%2C%20%26lt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eitem%3C%2FSPAN%3E%3CSPAN%3E%20%7C%20%7B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Elist%3C%2FSPAN%3E%3CSPAN%3E%7D%20%7C%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Epattern%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%2C%20%26lt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Edelimiter%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E...%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3EReturns%20a%20Boolean%20that%20indicates%20whether%20the%20word%20(%3CSPAN%20class%3D%22%22%3Eitem%3C%2FSPAN%3E)%2C%20one%20of%20a%20list%20of%20words%20(%3CSPAN%20class%3D%22%22%3Elist%3C%2FSPAN%3E)%2C%20or%20pattern%20(%3CSPAN%20class%3D%22%22%3Epattern%3C%2FSPAN%3E)%20matches%20one%20of%20the%20words%20in%20the%20text%20represented%20by%20%3CSPAN%20class%3D%22%22%3Ex%3C%2FSPAN%3E.%20Words%20are%20delimited%20by%20the%20characters%20in%20the%20optional%20quoted%20delimiter%20(%3CSPAN%20class%3D%22%22%3Edelimiter%3C%2FSPAN%3E)%20string.%20A%20comma%20is%20the%20default%20delimiter.%20Blanks%20are%20trimmed%20from%20the%20ends%20of%20each%20extracted%20word%20from%20the%20input%20text%20string%20(%3CSPAN%20class%3D%22%22%3Ex%3C%2FSPAN%3E).%3C%2FP%3E%3CP%3E%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20(to%20my%20simplistic%20reading)%20either%20x%20or%20the%20%7Blist%7D%20could%20contain%20the%20words%20to%20be%20searched%20or%20the%20list%20of%20words%20to%20compare%20it%20with.%20%26nbsp%3BA%20few%20more%20examples%20showing%20some%20alternatives%20that%20included%20a%20Column%20as%20in%20Jarmo's%20example%20might%20help%20clarify.%20%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20put%20the%20solution%20to%20use%20already!%20%26nbsp%3BThanks%20again.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810318%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810318%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EAh%2C%20great!%3CBR%20%2F%3E%3CBR%20%2F%3EIn%20the%20beginning%20I%20had%20quite%20bad%20experience%20with%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3EWhere()%3C%2FFONT%3E%20-%20but%20cannot%20remember%20why.%3CBR%20%2F%3EMaybe%20I%20used%20a%20wrong%20syntax%20-%20or%20the%20issue%20got%20fixed%20in%20the%20mean%20time%20...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810290%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810290%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20think%20it's%20worth%20adding%20that%20the%20Where()%20function%20is%20much%20faster%26nbsp%3B(%26gt%3B%20an%20order%20of%20magnitude!)%20than%20%26lt%3B%3CSELECT%20where%3D%22%22%20or%3D%22%22%3E%26lt%3B%3CGET%20rows%3D%22%22%20where.%3D%22%22%3E%3C%2FGET%3E%3C%2FSELECT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20to%20Here(%201%20)%3B%0Adt%20%3D%20Data%20Table(%20%22SATByYear%22%20)%3B%0AShow(%20N%20Rows(%20dt%20)%20)%3B%09%09%2F%2FN%20Rows(dt)%20%3D%2021245376%3B%0Anow%20%3D%20HP%20Time()%3B%0Adt%20%26lt%3B%26lt%3B%20Select%20Where(%20%3AState%20%3D%3D%20%22Wisconsin%22%20%7C%20%3AState%20%3D%3D%20%22Alabama%22%20)%3B%0AWait(%200%20)%3B%0Atotal%20%3D%20HP%20Time()%20-%20now%3B%0APrint(%20%22%26lt%3B%3CSELECT%20where%3D%22%22%20took%3D%22%22%3E%3C%2FSELECT%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810248%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810248%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ESorry%2C%20I%20missed%20a%20wait()%20in%20the%20previous%20runs%20-%20which%20inverts%20answer%201%20...%20and%20leads%20to%20new%20possibilities%20for%20%233%2C%26nbsp%3B%234%20%26amp%3B%20%235%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3Ethe%20new%20findings%3A%3C%2FP%3E%3COL%3E%3CLI%3E%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3EContains%20item()%3C%2FFONT%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20faster%20with%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F14366%22%20target%3D%22_blank%22%3E%40jthi%3C%2FA%3E%26nbsp%3B's%26nbsp%3B%20syntax%20-%20v2%20is%20slower%3C%2FLI%3E%3CLI%3E%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3ESelect%20where()%3C%2FFONT%3E%3CSPAN%3E%26nbsp%3Bgets%20much%20faster%20by%20replacing%20it%20with%26nbsp%3B%3C%2FSPAN%3E%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Eget%20rows%20where()%20%2B%20select%20rows().%3C%2FFONT%3E%3C%2FLI%3E%3CLI%3E%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3ESelect%20Where()%3C%2FFONT%3E%26nbsp%3Bgets%20significantly%20(!!)%20faster%20by%20replacing%20the%20string%20comparison%20with%20the%26nbsp%3B%26nbsp%3B%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Econtains%20item()%3C%2FFONT%3E.%3C%2FLI%3E%3CLI%3Ecombining%20(2)%26nbsp%3Band%20(3)%20is%20quite%20comparable%3C%2FLI%3E%3CLI%3E...%20also%20for%20larger%20data%20sets.%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22hogi_0-1731261697022.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_0-1731261697022.png%22%20style%3D%22width%3A%20330px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_0-1731261697022.png%22%20style%3D%22width%3A%20330px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70017i3B687F3FACA86149%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22hogi_0-1731261697022.png%22%20alt%3D%22hogi_0-1731261697022.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CDIV%20class%3D%22lia-spoiler-container%22%3E%3CA%20class%3D%22lia-spoiler-link%22%20href%3D%22%23%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EView%20more...%3C%2FA%3E%3CNOSCRIPT%3E%20(Highlight%20to%20read)%3C%2FNOSCRIPT%3E%3CDIV%20class%3D%22lia-spoiler-border%22%3E%3CDIV%20class%3D%22lia-spoiler-content%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enames%20default%20to%20here(1)%3B%0Adt%20%3D%20Open(%20%22%24SAMPLE_DATA%2FWafer%20Stacked.jmp%22%20)%3B%0A%0ANew%20Column(%20%22x_y%22%2C%0A%09Character%2C%0A%09Formula(%20Concat%20Items(%20%7BChar(%20%3AX_Die%20)%2C%20Char(%20%3AY_Die%20)%7D%2C%20%22_%22%20)%20)%0A)%3B%0A%0Await(0)%3B%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22contains%20item%22%2C%0A%09Character%2C%0A%09Formula(%20If(%20Contains%20Item(%20%221_3%203_9%22%2C%20%3Ax_y%2C%20%22%20%22%20)%2C%20%22exclude%22%2C%20%22not%20exclude%22%20)%20)%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20run%20formulas()%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%22formula%20-%20contains%20item%22%2C%20t)%3B%0A%0A%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22contains%20item%20v2%22%2C%0A%09Character%2C%0A%09Formula(%20If(%20Contains%20Item(%20%3Ax_y%2C%20%7B%223_1%22%2C%224_4%22%7D)%20%2C%20%22exclude%22%2C%20%22not%20exclude%22%20)%20)%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20run%20formulas()%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%221)%20formula%20-%20contains%20item%20v2%22%2C%20t)%3B%0A%0A%0A%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22get%20rows%20where%22%2C%0A%09Character%2C%0A%09set%20each%20value(%22not%20excluded%22)%20)%3B%0Amyrows%3D%5B%5D%3B%0Afor%20each(%20%7Bcompare%7D%2C%20%7B%223_1%22%2C%224_4%22%7D%2C%09%0A%09myrows%20%3D%20V%20concat%20to%20(myrows%2C%20%20dt%20%26lt%3B%26lt%3B%20get%20rows%20where(%3Ax_y%20%3D%3D%20compare))%3B%09%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20select%20rows(myrows)%3B%20%2F%2F%20just%20for%20fun%20-%20it's%20fast%0Adt%5Bmyrows%2C%22get%20rows%20where%22%5D%20%3D%20Repeat(%7B%22excluded%22%7D%2Cn%20items(myrows)%20)%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%222)%20get%20rows%20where%22%2C%20t)%3B%0A%0A%0A%0At0%3Dhptime()%3B%0Afor%20each(%20%7Bcompare%7D%2C%20%7B%223_1%22%2C%224_4%22%7D%2C%0A%09dt%26lt%3B%3CSELECT%20where%3D%22%22%3E%26nbsp%3B%26nbsp%3B%3C%2FSELECT%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FDIV%3E%3CNOSCRIPT%3E%3CDIV%20class%3D%22lia-spoiler-noscript-container%22%3E%3CDIV%20class%3D%22lia-spoiler-noscript-content%22%3E%26nbsp%3Bnames%20default%20to%20here(1)%3B%0Adt%20%3D%20Open(%20%22%24SAMPLE_DATA%2FWafer%20Stacked.jmp%22%20)%3B%0A%0ANew%20Column(%20%22x_y%22%2C%0A%09Character%2C%0A%09Formula(%20Concat%20Items(%20%7BChar(%20%3AX_Die%20)%2C%20Char(%20%3AY_Die%20)%7D%2C%20%22_%22%20)%20)%0A)%3B%0A%0Await(0)%3B%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22contains%20item%22%2C%0A%09Character%2C%0A%09Formula(%20If(%20Contains%20Item(%20%221_3%203_9%22%2C%20%3Ax_y%2C%20%22%20%22%20)%2C%20%22exclude%22%2C%20%22not%20exclude%22%20)%20)%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20run%20formulas()%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%22formula%20-%20contains%20item%22%2C%20t)%3B%0A%0A%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22contains%20item%20v2%22%2C%0A%09Character%2C%0A%09Formula(%20If(%20Contains%20Item(%20%3Ax_y%2C%20%7B%223_1%22%2C%224_4%22%7D)%20%2C%20%22exclude%22%2C%20%22not%20exclude%22%20)%20)%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20run%20formulas()%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%221)%20formula%20-%20contains%20item%20v2%22%2C%20t)%3B%0A%0A%0A%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22get%20rows%20where%22%2C%0A%09Character%2C%0A%09set%20each%20value(%22not%20excluded%22)%20)%3B%0Amyrows%3D%5B%5D%3B%0Afor%20each(%20%7Bcompare%7D%2C%20%7B%223_1%22%2C%224_4%22%7D%2C%09%0A%09myrows%20%3D%20V%20concat%20to%20(myrows%2C%20%20dt%20%26lt%3B%26lt%3B%20get%20rows%20where(%3Ax_y%20%3D%3D%20compare))%3B%09%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20select%20rows(myrows)%3B%20%2F%2F%20just%20for%20fun%20-%20it's%20fast%0Adt%5Bmyrows%2C%22get%20rows%20where%22%5D%20%3D%20Repeat(%7B%22excluded%22%7D%2Cn%20items(myrows)%20)%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%222)%20get%20rows%20where%22%2C%20t)%3B%0A%0A%0A%0At0%3Dhptime()%3B%0Afor%20each(%20%7Bcompare%7D%2C%20%7B%223_1%22%2C%224_4%22%7D%2C%0A%09dt%26lt%3B%3CSELECT%20where%3D%22%22%3E%3C%2FSELECT%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FNOSCRIPT%3E%3C%2FDIV%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22hogi_0-1731305493836.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_0-1731305493836.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_0-1731305493836.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70019i116F7A07829AD82B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22hogi_0-1731305493836.png%22%20alt%3D%22hogi_0-1731305493836.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810228%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810228%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Eadded%20it%20to%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FDiscussions%2FTips-and-Tricks-best-practice-with-JMP-JSL%2Fm-p%2F662686%23U662686%22%20class%3D%22lia-mention-container-editor-message%20lia-img-icon-forum-thread%20lia-fa-icon%20lia-fa-forum%20lia-fa-thread%20lia-fa%22%20target%3D%22_blank%22%3ETips%20and%20Tricks%20-%20best%20practice%20with%20JMP%2FJSL%3C%2FA%3E%26nbsp%3B%3CBR%20%2F%3E%234%20is%20surprising.%20At%20the%20moment%2C%20I'd%20say%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22hogi_0-1731241802910.png%22%20style%3D%22width%3A%20684px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_0-1731241802910.png%22%20style%3D%22width%3A%20684px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_0-1731241802910.png%22%20style%3D%22width%3A%20684px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70011iB71AF709F9A7735D%2Fimage-dimensions%2F684x93%3Fv%3Dv2%22%20width%3D%22684%22%20height%3D%2293%22%20role%3D%22button%22%20title%3D%22hogi_0-1731241802910.png%22%20alt%3D%22hogi_0-1731241802910.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810225%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810225%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThanks%20for%20the%20comment.%3CBR%20%2F%3Edigging%20deeper%20-%20actually%20it's%20not%20%3CSTRONG%3Econtains%20item%3C%2FSTRONG%3E%20versus%20%3CSTRONG%3ESelect%20Where%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Esome%20findings%3A%3C%2FP%3E%3COL%3E%3CLI%3E%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3EContains%20item()%3C%2FFONT%3E%20is%20faster%20with%20the%20inverse%20%22v2%22%20syntax%3C%2FLI%3E%3CLI%3E%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3ESelect%20where()%3C%2FFONT%3E%3CSPAN%3E%20gets%20much%20faster%20by%20replacing%20it%20with%20%3C%2FSPAN%3E%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Eget%20rows%20where()%20%2B%20select%20rows().%3C%2FFONT%3E%3C%2FLI%3E%3CLI%3E%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3ESelect%20Where()%3C%2FFONT%3E%26nbsp%3Bgets%20significantly%20faster%20by%20replacing%20the%20string%20comparison%20with%20the%26nbsp%3B%26nbsp%3B%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Econtains%20item()%3C%2FFONT%3E.%3C%2FLI%3E%3CLI%3Eand%20combining%20(2)%26nbsp%3Band%20(3)%20makes%20it%20...%20factor%202%20slower%20than%20(2)%26nbsp%3B%20(%3F!%3F!)%3C%2FLI%3E%3CLI%3Eso%2C%20the%20winner%20(for%20this%20data%20set)%20is%20%232%3A%3C%2FLI%3E%3C%2FOL%3E%3CP%3Ein%20total%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22hogi_1-1731241317667.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_1-1731241317667.png%22%20style%3D%22width%3A%20318px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_1-1731241317667.png%22%20style%3D%22width%3A%20318px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70010i802B20976A6FB607%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22hogi_1-1731241317667.png%22%20alt%3D%22hogi_1-1731241317667.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Edetails%3A%3C%2FP%3E%3CDIV%20class%3D%22lia-spoiler-container%22%3E%3CA%20class%3D%22lia-spoiler-link%22%20href%3D%22%23%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EView%20more...%3C%2FA%3E%3CNOSCRIPT%3E%20(Highlight%20to%20read)%3C%2FNOSCRIPT%3E%3CDIV%20class%3D%22lia-spoiler-border%22%3E%3CDIV%20class%3D%22lia-spoiler-content%22%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enames%20default%20to%20here(1)%3B%0Adt%20%3D%20Open(%20%22%24SAMPLE_DATA%2FWafer%20Stacked.jmp%22%20)%3B%0A%0ANew%20Column(%20%22x_y%22%2C%0A%09Character%2C%0A%09Formula(%20Concat%20Items(%20%7BChar(%20%3AX_Die%20)%2C%20Char(%20%3AY_Die%20)%7D%2C%20%22_%22%20)%20)%0A)%3B%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22contains%20item%22%2C%0A%09Character%2C%0A%09Formula(%20If(%20Contains%20Item(%20%221_3%203_9%22%2C%20%3Ax_y%2C%20%22%20%22%20)%2C%20%22exclude%22%2C%20%22not%20exclude%22%20)%20)%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20run%20formulas()%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%22formula%20-%20contains%20item%22%2C%20t)%3B%0A%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22contains%20item%20v2%22%2C%0A%09Character%2C%0A%09Formula(%20If(%20Contains%20Item(%20%3Ax_y%2C%20%7B%223_1%22%2C%224_4%22%7D)%20%2C%20%22exclude%22%2C%20%22not%20exclude%22%20)%20)%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20run%20formulas()%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%221)%20formula%20-%20contains%20item%20v2%22%2C%20t)%3B%0A%0A%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22get%20rows%20where%22%2C%0A%09Character%2C%0A%09set%20each%20value(%22not%20excluded%22)%20)%3B%0Amyrows%3D%5B%5D%3B%0Afor%20each(%20%7Bcompare%7D%2C%20%7B%223_1%22%2C%224_4%22%7D%2C%09%0A%09myrows%20%3D%20V%20concat%20to%20(myrows%2C%20%20dt%20%26lt%3B%26lt%3B%20get%20rows%20where(%3Ax_y%20%3D%3D%20compare))%3B%09%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20select%20rows(myrows)%3B%20%2F%2F%20just%20for%20fun%20-%20it's%20fast%0Adt%5Bmyrows%2C%22get%20rows%20where%22%5D%20%3D%20Repeat(%7B%22excluded%22%7D%2Cn%20items(myrows)%20)%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%222)%20get%20rows%20where%22%2C%20t)%3B%0A%0A%0A%0At0%3Dhptime()%3B%0Afor%20each(%20%7Bcompare%7D%2C%20%7B%223_1%22%2C%224_4%22%7D%2C%0A%09dt%26lt%3B%3CSELECT%20where%3D%22%22%3E%3C%2FSELECT%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FDIV%3E%3CNOSCRIPT%3E%3CDIV%20class%3D%22lia-spoiler-noscript-container%22%3E%3CDIV%20class%3D%22lia-spoiler-noscript-content%22%3Enames%20default%20to%20here(1)%3B%0Adt%20%3D%20Open(%20%22%24SAMPLE_DATA%2FWafer%20Stacked.jmp%22%20)%3B%0A%0ANew%20Column(%20%22x_y%22%2C%0A%09Character%2C%0A%09Formula(%20Concat%20Items(%20%7BChar(%20%3AX_Die%20)%2C%20Char(%20%3AY_Die%20)%7D%2C%20%22_%22%20)%20)%0A)%3B%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22contains%20item%22%2C%0A%09Character%2C%0A%09Formula(%20If(%20Contains%20Item(%20%221_3%203_9%22%2C%20%3Ax_y%2C%20%22%20%22%20)%2C%20%22exclude%22%2C%20%22not%20exclude%22%20)%20)%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20run%20formulas()%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%22formula%20-%20contains%20item%22%2C%20t)%3B%0A%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22contains%20item%20v2%22%2C%0A%09Character%2C%0A%09Formula(%20If(%20Contains%20Item(%20%3Ax_y%2C%20%7B%223_1%22%2C%224_4%22%7D)%20%2C%20%22exclude%22%2C%20%22not%20exclude%22%20)%20)%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20run%20formulas()%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%221)%20formula%20-%20contains%20item%20v2%22%2C%20t)%3B%0A%0A%0A%0At0%3Dhptime()%3B%0ANew%20Column(%20%22get%20rows%20where%22%2C%0A%09Character%2C%0A%09set%20each%20value(%22not%20excluded%22)%20)%3B%0Amyrows%3D%5B%5D%3B%0Afor%20each(%20%7Bcompare%7D%2C%20%7B%223_1%22%2C%224_4%22%7D%2C%09%0A%09myrows%20%3D%20V%20concat%20to%20(myrows%2C%20%20dt%20%26lt%3B%26lt%3B%20get%20rows%20where(%3Ax_y%20%3D%3D%20compare))%3B%09%0A)%3B%0Adt%20%26lt%3B%26lt%3B%20select%20rows(myrows)%3B%20%2F%2F%20just%20for%20fun%20-%20it's%20fast%0Adt%5Bmyrows%2C%22get%20rows%20where%22%5D%20%3D%20Repeat(%7B%22excluded%22%7D%2Cn%20items(myrows)%20)%3B%0At%3D%20(hptime()-t0)%2F1000000%3B%0Aprint(%222)%20get%20rows%20where%22%2C%20t)%3B%0A%0A%0A%0At0%3Dhptime()%3B%0Afor%20each(%20%7Bcompare%7D%2C%20%7B%223_1%22%2C%224_4%22%7D%2C%0A%09dt%26lt%3B%3CSELECT%20where%3D%22%22%3E%3C%2FSELECT%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FNOSCRIPT%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810214%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810214%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20did%20some%20timing%20tests%20comparing%20Jarmo's%20solution%20compared%20to%20my%20solution%2C%20and%20the%20Contains%20Item%20solution%20is%20spectacularly%20faster%20than%20the%20Select%20Where%20solution.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810205%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810205%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EUsually%20in%20cases%20like%20this%20I%20tend%20to%20use%20Words()%20to%20split%20the%20string%20into%20a%20list%20and%20then%20compare%20using%20Contains()%20(or%20in%20some%20rare%20cases%20Contains%20Item()).%20But%20Contains%20Item()%20should%20also%20work%20and%20you%20just%20seem%20to%20have%20your%20parameters%20in%20incorrect%20order%3CCODE%20class%3D%22%20language-jsl%22%3E%3C%2FCODE%3E%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENew%20Table(%22Untitled%22%2C%0A%09Add%20Rows(3)%2C%0A%09Compress%20File%20When%20Saved(1)%2C%0A%09New%20Column(%22Column%201%22%2C%20Character%2C%20%22Nominal%22%2C%20Set%20Values(%7B%221_3%22%2C%20%223_7%22%2C%20%226_5%22%7D))%2C%0A%09New%20Column(%22Column%202%22%2C%0A%09%09Character%2C%0A%09%09%22Nominal%22%2C%0A%09%09Formula(%0A%09%09%09If(Contains%20Item(%221_3%203_9%22%2C%20%3AColumn%201%2C%20%22%20%22)%2C%0A%09%09%09%09%22exclude%22%2C%0A%09%09%09%09%22not%20exclude%22%0A%09%09%09)%0A%09%09)%2C%0A%09%09Set%20Selected%0A%09)%0A)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jthi_0-1731165057018.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_0-1731165057018.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_0-1731165057018.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F69998i2CF339F64E748A67%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jthi_0-1731165057018.png%22%20alt%3D%22jthi_0-1731165057018.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ESecond%20example%20from%20Scripting%20Index%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jthi_1-1731165235628.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_1-1731165235628.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_1-1731165235628.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F69999iA84B197CAF014387%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jthi_1-1731165235628.png%22%20alt%3D%22jthi_1-1731165235628.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jthi_2-1731165277236.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_2-1731165277236.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_2-1731165277236.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70000i70FDF9BF6918DBDD%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jthi_2-1731165277236.png%22%20alt%3D%22jthi_2-1731165277236.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eor%20JSL%20Syntax%20Reference%20have%20okeish%20examples%20%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F18.0%2F%23page%2Fjmp%2Fcharacter-functions-2.shtml%3Fos%3Dwin%26amp%3Bsource%3Dapplication%23ww6166335%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F18.0%2F%23page%2Fjmp%2Fcharacter-functions-2.shtml%3Fos%3Dwin%26amp%3Bsource%3Dapplication%23ww6166335%3C%2FA%3E%20but%20the%20documentation%20is%20bit%20lacking.%20%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810201%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Formula%20to%20check%20if%20any%20of%20a%20list%20of%20items%20is%20contained%20in%20the%20rows%20of%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810201%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHere%20is%20the%20approach%20I%20would%20take%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enames%20default%20to%20here(1)%3B%0Adt%3Dcurrent%20data%20table()%3B%0A%0Adt%20%26lt%3B%26lt%3B%20clear%20select%3B%0A%0Afind%20%3D%20%7B%223_1%22%2C%224_4%22%7D%3B%0A%0Afor%20each(%20%7Bcompare%7D%2C%20find%2C%0A%09dt%26lt%3B%3CSELECT%20where%3D%22%22%3E%3C%2FSELECT%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EOnce%20the%20rows%20are%20selected%2C%20then%20excluding%2C%20deleting%20etc.%20can%20be%20done.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
datanaut
Level III

Formula to check if any of a list of items is contained in the rows of a column

JMP for Mac 

Version 17.2.0 (701896)

 

I have a column "Data" with rows of number_number like this:

1_3

3_7

6_5

...

 

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.

 

I know I could construct an elaborate formula like this:

If( :Die X_Y == "3_9" | :Die X_Y == "3_4",
	1,
	0
)

But that's very laborious for long lists of different values to check.  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.  

 

I found the function "Contains Item."  It works fine for one item but the help entry doesn't offer any insight on how to construct the "list" option.  I tried this (specifying the optional delimiter as a space):

If( Contains Item( :Die X_Y, "3_4 3_9", " " ),
	"exclude",
	"not exclude"
)

and this:

If( Contains Item( :Data, "3_4,3_9", "," ),
	"exclude",
	"not exclude"
)

I understand the default delimiter is a comma but wanted to enforce to find anything that works.  Neither Contains Item function is returning the sought-for behavior (logical 1 if there is a match, 0 if not).  If there is a better function to use please advise.  

 

This is a generalized problem I'd like to be able to solve -- inspecting a column to find matches with long lists of items.  

 

Thanks

 

15 REPLIES 15
hogi
Level XIII

Re: Formula to check if any of a list of items is contained in the rows of a column

the reading is: 3 arguments

  1. x - a string of characters
  2. 3 options:
    - item to search
    - a list of several items - does one of them match?
    - a pattern to search
  3. optional argument: the delimiter to split x in words

 


@datanaut wrote:

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.  


-> yes.

 

 included a Column as in Jarmo's example 

For a column formula, this is always possible, along the idea:
For every row, JMP will take automatically the entry of the column in the respective row.
When you use Formula editor, you do this trick all the time - just without noting.

hogi
Level XIII

Re: Formula to check if any of a list of items is contained in the rows of a column

A nice side effect:

This discussion made me think:
does Contains also increase the speed of Col .. aggregations?

And believe it or not - it does. wow, it does!!!!

https://community.jmp.com/t5/Discussions/How-do-I-use-the-Col-Maximum-Formula-with-a-quot-where-quot... 

 

Any clue why the character comparison is SOOO slow?

hogi
Level XIII

Re: Formula to check if any of a list of items is contained in the rows of a column

I wondered if deleting rows without selecting them is much faster:

dt << select rows(myRows) << delete rows();
dt << delete rows();

[actually, I wondered why the corresponding << exclude(myRows) is missing.]

 

So, here is another speed test:

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 ) > 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 << select rows( myRows ) << delete rows ) );

get timing( Expr( dt << delete rows( myRows ) ) );

get timing( Expr( dt << select rows( myRows ) << exclude( 1 ) ) );

Print("-------------");

get timing( Expr( dt << select where( :rnd > 500 ) ) );

get timing( Expr( dt << get rows where( :rnd > 500 ) ) );

get timing( Expr( myRows = Where( dt, :rnd > 500 ) ) );

Print("_____________");
	

hogi_1-1764746400738.png

So,  deleting rows without selecting them is just marginally faster.
-> no wonder there is no corresponding function for Exclude.

hogi
Level XIII

Re: Formula to check if any of a list of items is contained in the rows of a column

by the way:

Print("_________");
Print("__X______");
Print("X________");

hogi_2-1764747078244.png

why?

jthi
Super User

Re: Formula to check if any of a list of items is contained in the rows of a column

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 -> possibly some interaction with Print() to not make it leak those values.

-Jarmo
hogi
Level XIII

Re: Formula to check if any of a list of items is contained in the rows of a column

show("__");
myString="__";
show(myString);
show("_"|| "_");

__x="secret";
show(__x);
show(name Expr(__x));
show(Eval(__x));

hogi_0-1764749234016.png

 

a second layer of ulra-tight protection ; )

Recommended Articles