<?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 JMP Script : Creation of a new list in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622499#M82145</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I created a list named Y_list containing variable names. From this list, I would like to create a new list, containing only the variable names which contains values in the dataset.&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Y_list contains {"height", "Weight", "Age"}&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_LimitsKey&lt;/TD&gt;&lt;TD&gt;height&lt;/TD&gt;&lt;TD&gt;Weight&lt;/TD&gt;&lt;TD&gt;Age&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;_UCL&lt;/TD&gt;&lt;TD&gt;54&lt;/TD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;_LCL&lt;/TD&gt;&lt;TD&gt;72&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;As there is no value in the Age row, I would like to create a new list containing only variables names which contains data :&amp;nbsp;&lt;/P&gt;&lt;P&gt;Y_new_list ==&amp;gt; {"height", "Weight"}&lt;/P&gt;&lt;P&gt;However, I do not know how to make this new list with JMP script.&lt;/P&gt;&lt;P&gt;Do you have any suggestion to help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sebastien&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 16:07:56 GMT</pubDate>
    <dc:creator>Sebastienlg</dc:creator>
    <dc:date>2023-06-09T16:07:56Z</dc:date>
    <item>
      <title>JMP Script : Creation of a new list</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622499#M82145</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I created a list named Y_list containing variable names. From this list, I would like to create a new list, containing only the variable names which contains values in the dataset.&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Y_list contains {"height", "Weight", "Age"}&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_LimitsKey&lt;/TD&gt;&lt;TD&gt;height&lt;/TD&gt;&lt;TD&gt;Weight&lt;/TD&gt;&lt;TD&gt;Age&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;_UCL&lt;/TD&gt;&lt;TD&gt;54&lt;/TD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;_LCL&lt;/TD&gt;&lt;TD&gt;72&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;As there is no value in the Age row, I would like to create a new list containing only variables names which contains data :&amp;nbsp;&lt;/P&gt;&lt;P&gt;Y_new_list ==&amp;gt; {"height", "Weight"}&lt;/P&gt;&lt;P&gt;However, I do not know how to make this new list with JMP script.&lt;/P&gt;&lt;P&gt;Do you have any suggestion to help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sebastien&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:07:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622499#M82145</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2023-06-09T16:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script : Creation of a new list</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622514#M82146</link>
      <description>&lt;P&gt;If you have JMP16+ below is one option using Filter Each and checking if column only has missing values with IsMissing&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

input_list = {"height", "Weight", "Age"};

dt = New Table("Untitled 6",
	Add Rows(2),
	Compress File When Saved(1),
	New Column("_LimitsKey", Character, "Nominal", Set Values({"_UCL", "_LCL"})),
	New Column("height", Numeric, "Continuous", Format("Best", 12), Set Values([54, 72])),
	New Column("Weight", Numeric, "Continuous", Format("Best", 12), Set Values([80, 150])),
	New Column("Age", Numeric, "Nominal", Format("", 16), Set Values([., .]))
);

new_list = Filter Each({list_val}, input_list,
	found_values = Sum(!IsMissing(dt[0, list_val]));
	found_values &amp;gt; 0;
);

show(new_list);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Adding debug prints inside Filter Each might be helpful to understand what is going on. Such as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	Show(dt[0, list_val]);
	Show(IsMissing(dt[0, list_val]));
	Show(!IsMissing(dt[0, list_val]));
	show(found_values);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There are also many other ways of doing this (like most of the time with jmp)&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 08:53:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622514#M82146</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-04-14T08:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script : Creation of a new list</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622911#M82190</link>
      <description>&lt;P&gt;Great, It is working well! Thaks a lot!&lt;/P&gt;&lt;P&gt;I would like to implement an if condition based on this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the Y column is included in the list_val created, then...&lt;/P&gt;&lt;P&gt;How can I write this condition?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If (Eval(Y) &lt;FONT color="#FF0000"&gt;!=&lt;/FONT&gt; list_val,
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I think the != is not adapted...&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 09:43:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622911#M82190</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2023-04-17T09:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script : Creation of a new list</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622935#M82194</link>
      <description>&lt;P&gt;Use &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/character-functions-2.shtml?os=win&amp;amp;source=application#ww2467451" target="_blank" rel="noopener"&gt;Contains()&lt;/A&gt;&amp;nbsp;with If() to check if item is found from a list&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Contains({"a","b","c"}, "b");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or you can use &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/character-functions-2.shtml#ww6166335" target="_blank" rel="noopener"&gt;Contains Item()&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Contains Item("b", {"a","b","c"});&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Apr 2023 12:07:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622935#M82194</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-04-17T12:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script : Creation of a new list</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622962#M82195</link>
      <description>&lt;P&gt;Thanks for your reply,&lt;/P&gt;&lt;P&gt;It should work but JMP does not like the Eval(Y) and always return 0:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;r=Contains(list_val, Eval(Y))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For information, the Y is made like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Y = concat(Y,"  (ppm)");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;Sebastien&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 13:19:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/622962#M82195</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2023-04-17T13:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script : Creation of a new list</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/623025#M82202</link>
      <description>&lt;P&gt;I'm not exactly sure what you are trying to do? Why are you using Eval? Usually it is easier to handle column names as strings and then when you need them convert them to column references in some way&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 17:55:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/623025#M82202</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-04-17T17:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script : Creation of a new list</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/623144#M82206</link>
      <description>&lt;P&gt;I am using the Eval because it is based on the user selection and then the concatenation:&lt;/P&gt;&lt;LI-CODE lang="jsl"&gt;Y = concat(Y,"  (ppm)");&lt;/LI-CODE&gt;&lt;P&gt;Then I need to determine if this user selection can be found in the list:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;r=Contains(list_val, Eval(Y))&lt;/LI-CODE&gt;&lt;P&gt;I tried this also&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;r=Contains(list_val, Y)&lt;/LI-CODE&gt;&lt;P&gt;But also always return 0...&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 20:11:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Creation-of-a-new-list/m-p/623144#M82206</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2023-04-17T20:11:37Z</dc:date>
    </item>
  </channel>
</rss>

