<?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: Regarding the issue of generating dynamic variable names using nested loops in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/902542#M106157</link>
    <description>&lt;P&gt;One of the few places where &lt;FONT face="courier new,courier"&gt;Parse()&lt;/FONT&gt; is needed - and there seems to be no easier approach via Expression handling:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;generation of variable names.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the other hand:&lt;/P&gt;
&lt;P&gt;In 99% of such cases, one can zoom out one step and search for an easier approach for the main target.&lt;BR /&gt;One which doesn't rely on custom made variable names.&lt;BR /&gt;&lt;BR /&gt;e.g. use a 2D array, nested lists or associative array of associative arrays.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt; fruit_month&lt;/FONT&gt;&lt;BR /&gt;and indexing like&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;fruit_month[i,j], (fruit_month[i])[j]&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;(fruit_month[month])[fruit]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;instead of a "2D-Array" of variable names.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Sep 2025 11:00:59 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2025-09-22T11:00:59Z</dc:date>
    <item>
      <title>Regarding the issue of generating dynamic variable names using nested loops</title>
      <link>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/902496#M106151</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Regarding the dynamic variable issue, here is the JSL below. I want to generate variable names combining fruit and month, for example, Apple_Jun. However, the following JSL does not run. How should I fix it?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;FruitList = {"Apple", "Banana", "Cherry", "Durian", "Entawak"};
MonthList = {"_Jan", "_Feb", "_March", "_April", "_May"};
For( count = 1, count &amp;lt;= N Items( FruitList ), count++,
	For( countM = 1, countM &amp;lt;= N Items( MonthList ), countM++, 

		ex = Expr(
			Parse( Fruit || Month ) = 1;
			
		);
		Substitute Into( ex,
			Expr( Fruit ), FruitList[Count],
			Expr( Month ),
				MonthList[CountM]
			
		);
	);
	Eval( ex );
);

Show( Apple_Jan );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Sep 2025 08:02:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/902496#M106151</guid>
      <dc:creator>BabyDoragon</dc:creator>
      <dc:date>2025-09-22T08:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding the issue of generating dynamic variable names using nested loops</title>
      <link>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/902526#M106154</link>
      <description>&lt;P&gt;You have made the JSL far more complex than required&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
FruitList = {"Apple", "Banana", "Cherry", "Durian", "Entawak"};
MonthList = {"_Jan", "_Feb", "_March", "_April", "_May"};
ColNamesList = {};
For Each( {Month}, MonthList,
	For Each( {Fruit}, FruitList,
		Insert Into( ColNamesList, Fruit || Month )
	)
);
Show( ColNamesList );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Sep 2025 08:51:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/902526#M106154</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-09-22T08:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding the issue of generating dynamic variable names using nested loops</title>
      <link>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/902528#M106155</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CoverMarmoset89_0-1758531601120.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/83125i8B5B78CD7AD46CDB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CoverMarmoset89_0-1758531601120.png" alt="CoverMarmoset89_0-1758531601120.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2025 09:00:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/902528#M106155</guid>
      <dc:creator>lwencx</dc:creator>
      <dc:date>2025-09-22T09:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding the issue of generating dynamic variable names using nested loops</title>
      <link>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/902542#M106157</link>
      <description>&lt;P&gt;One of the few places where &lt;FONT face="courier new,courier"&gt;Parse()&lt;/FONT&gt; is needed - and there seems to be no easier approach via Expression handling:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;generation of variable names.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the other hand:&lt;/P&gt;
&lt;P&gt;In 99% of such cases, one can zoom out one step and search for an easier approach for the main target.&lt;BR /&gt;One which doesn't rely on custom made variable names.&lt;BR /&gt;&lt;BR /&gt;e.g. use a 2D array, nested lists or associative array of associative arrays.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt; fruit_month&lt;/FONT&gt;&lt;BR /&gt;and indexing like&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;fruit_month[i,j], (fruit_month[i])[j]&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;(fruit_month[month])[fruit]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;instead of a "2D-Array" of variable names.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2025 11:00:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/902542#M106157</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-09-22T11:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding the issue of generating dynamic variable names using nested loops</title>
      <link>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/904486#M106332</link>
      <description>&lt;P&gt;There are very very limited cases where you might generate dynamic variable names and usually even with those, you shouldn't.&amp;nbsp;Instead, consider using proper data structure (table, &lt;STRONG&gt;associative array&lt;/STRONG&gt;, lists, ...).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example using associative array&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

FruitList = {"Apple", "Banana", "Cherry", "Durian", "Entawak"};
MonthList = {"_Jan", "_Feb", "_March", "_April", "_May"};

aa = Associative Array(FruitList, Repeat({Associative Array(MonthList, As List(Repeat(1, N Items(MonthList))))}, N Items(FruitList)));

aa = Associative Array();
For Each({fruit}, fruitlist,
	For Each({month}, monthlist,
		If(!Contains(aa, fruit),
			aa[fruit] = Associative Array();
		);
		aa[fruit][month] = 1;
	);	
);
Show(aa["Apple"]["_Jan"]);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Difficult to read version&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

FruitList = {"Apple", "Banana", "Cherry", "Durian", "Entawak"};
MonthList = {"_Jan", "_Feb", "_March", "_April", "_May"};

aa = Associative Array(FruitList, Repeat({Associative Array(MonthList, As List(Repeat(1, N Items(MonthList))))}, N Items(FruitList)));

Show(aa["Apple"]["_Jan"]);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 Sep 2025 16:37:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Regarding-the-issue-of-generating-dynamic-variable-names-using/m-p/904486#M106332</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-09-28T16:37:32Z</dc:date>
    </item>
  </channel>
</rss>

