<?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: Create a list for each elements present in a list. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/465322#M70939</link>
    <description>&lt;P&gt;Just a quick point -- using &lt;CODE class=" language-jsl"&gt;Eval( Parse( Eval Insert( ... ) ) )&lt;/CODE&gt; can be somewhat cumbersome and slow (although the slowdown is only apparent with a great many calls).&amp;nbsp; You can avoid it by accessing the "here" namespace directly, as follows:&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 );

MasterList = {"test1", "test2"};

here = Namespace( "here" );
// many variables containing lists
For Each( {item}, Masterlist, here[item || "value"] = {} );
Show( test1value, test2value );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Feb 2022 17:01:54 GMT</pubDate>
    <dc:creator>ErraticAttack</dc:creator>
    <dc:date>2022-02-28T17:01:54Z</dc:date>
    <item>
      <title>Create a list for each elements present in a list.</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/464319#M70888</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trying to create a list for each items present in a list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Already have,&lt;/P&gt;&lt;P&gt;MasterList = {"test1", "test2"};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Required,&lt;/P&gt;&lt;P&gt;Append the string "value" to each items present in the MasterList and have to make each item as an individual list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;test1value = {};&lt;/P&gt;&lt;P&gt;test2value = {};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, Alex.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:11:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/464319#M70888</guid>
      <dc:creator>AlexR846</dc:creator>
      <dc:date>2023-06-09T18:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create a list for each elements present in a list.</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/464362#M70893</link>
      <description>&lt;P&gt;Probably this helps&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

MasterList = {"test1", "test2"};

For Each( {item}, Masterlist, Eval( Parse( Eval Insert( "^item^value= {};" ) ) ) );
Show( test1value, test2value );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Feb 2022 15:44:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/464362#M70893</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2022-02-25T15:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create a list for each elements present in a list.</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/464384#M70895</link>
      <description>&lt;P&gt;You might want to use &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/associative-arrays.shtml#" target="_self"&gt;Associative Arrays&lt;/A&gt; instead of Lists.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Feb 2022 16:50:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/464384#M70895</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2022-02-25T16:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create a list for each elements present in a list.</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/464625#M70910</link>
      <description>&lt;P&gt;Great Idea of Mark.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This may look as follows in your case. You can effectively manage many lists in an Associative Array.&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 );

MasterList = {"test1", "test2"};

// many variables containing lists
For Each( {item}, Masterlist, Eval( Parse( Eval Insert( "^item^value= {};" ) ) ) );
Show( test1value, test2value );

// associative array containing lists
Master_AA = Associative Array();
For Each( {item, index}, Masterlist, Master_AA[Masterlist[index] || "value"] = {} );&lt;BR /&gt;Master_AA["test1value"] = {1, 2, 3};
For Each( {key}, Master_AA, Show( key, Master_AA[key] ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 26 Feb 2022 07:32:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/464625#M70910</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2022-02-26T07:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create a list for each elements present in a list.</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/464651#M70917</link>
      <description>&lt;P&gt;Thank you Georg, &amp;amp; Mark !!&lt;/P&gt;&lt;P&gt;Both solutions did the job !!&lt;/P&gt;</description>
      <pubDate>Sat, 26 Feb 2022 16:14:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/464651#M70917</guid>
      <dc:creator>AlexR846</dc:creator>
      <dc:date>2022-02-26T16:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create a list for each elements present in a list.</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/465070#M70921</link>
      <description>&lt;P&gt;Slightly different approach using an associative array:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

MasterList = {"test1", "test2"};

// associative array containing lists
Master_AA = Associative Array();
for (i = 1, i &amp;lt;= nitems(masterlist), i++,
	one_key = masterlist[i];
	master_aa[one_key] = {};
);

// Load the lists with some data
insertinto(master_aa["test1"], {1, 2, 3});
insertinto(master_aa["test2"], {4, 5, 6});

print(master_aa);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;["test1" =&amp;gt; {1, 2, 3}, "test2" =&amp;gt; {4, 5, 6}]&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 27 Feb 2022 22:04:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/465070#M70921</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2022-02-27T22:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create a list for each elements present in a list.</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/465322#M70939</link>
      <description>&lt;P&gt;Just a quick point -- using &lt;CODE class=" language-jsl"&gt;Eval( Parse( Eval Insert( ... ) ) )&lt;/CODE&gt; can be somewhat cumbersome and slow (although the slowdown is only apparent with a great many calls).&amp;nbsp; You can avoid it by accessing the "here" namespace directly, as follows:&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 );

MasterList = {"test1", "test2"};

here = Namespace( "here" );
// many variables containing lists
For Each( {item}, Masterlist, here[item || "value"] = {} );
Show( test1value, test2value );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Feb 2022 17:01:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-list-for-each-elements-present-in-a-list/m-p/465322#M70939</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2022-02-28T17:01:54Z</dc:date>
    </item>
  </channel>
</rss>

