<?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 Are nested loops possible using JSL? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Are-nested-loops-possible-using-JSL/m-p/1792#M1792</link>
    <description>Is there a way to script a nested loop statement using JSL?  I'm running into errors when I try.  I am writing a script that transforms a dataset using indirect lognormal correction for change of support and I think I need a nested WHILE statement to make it work.&lt;BR /&gt;&lt;BR /&gt;Although I realize the syntax is not entirely correct, the following illustration conveys what I am trying to do:&lt;BR /&gt;&lt;BR /&gt;i=1;&lt;BR /&gt;j=1;&lt;BR /&gt;n=NRow() // with more than 209,000 rows&lt;BR /&gt;&lt;BR /&gt;While( i &amp;lt; n-1,&lt;BR /&gt;    While( j &amp;lt; n,&lt;BR /&gt;         s = s + ( data(i) * data(j),&lt;BR /&gt;         j = j++),&lt;BR /&gt;    i = i++);&lt;BR /&gt;&lt;BR /&gt;There is always more than one way to accomplish things, so if JSL does not support nested loops does anyone have any suggestions?</description>
    <pubDate>Tue, 11 May 2010 14:31:25 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-05-11T14:31:25Z</dc:date>
    <item>
      <title>Are nested loops possible using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/Are-nested-loops-possible-using-JSL/m-p/1792#M1792</link>
      <description>Is there a way to script a nested loop statement using JSL?  I'm running into errors when I try.  I am writing a script that transforms a dataset using indirect lognormal correction for change of support and I think I need a nested WHILE statement to make it work.&lt;BR /&gt;&lt;BR /&gt;Although I realize the syntax is not entirely correct, the following illustration conveys what I am trying to do:&lt;BR /&gt;&lt;BR /&gt;i=1;&lt;BR /&gt;j=1;&lt;BR /&gt;n=NRow() // with more than 209,000 rows&lt;BR /&gt;&lt;BR /&gt;While( i &amp;lt; n-1,&lt;BR /&gt;    While( j &amp;lt; n,&lt;BR /&gt;         s = s + ( data(i) * data(j),&lt;BR /&gt;         j = j++),&lt;BR /&gt;    i = i++);&lt;BR /&gt;&lt;BR /&gt;There is always more than one way to accomplish things, so if JSL does not support nested loops does anyone have any suggestions?</description>
      <pubDate>Tue, 11 May 2010 14:31:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Are-nested-loops-possible-using-JSL/m-p/1792#M1792</guid>
      <dc:creator />
      <dc:date>2010-05-11T14:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Are nested loops possible using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/Are-nested-loops-possible-using-JSL/m-p/1793#M1793</link>
      <description>Sure you can nest loops. Here's a very simple example using nested "for" loops. Look in the log for the results.&lt;BR /&gt;</description>
      <pubDate>Tue, 11 May 2010 17:06:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Are-nested-loops-possible-using-JSL/m-p/1793#M1793</guid>
      <dc:creator>mpb</dc:creator>
      <dc:date>2010-05-11T17:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Are nested loops possible using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/Are-nested-loops-possible-using-JSL/m-p/1794#M1794</link>
      <description>mpb, &lt;BR /&gt;&lt;BR /&gt;You are absolutely correct.  Your script works just as it should.  The problem with my script turned out to be a bit of code preceding the loop where I tried reusing a variable and it wasn't overwriting the original value the way I thought it would.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help!</description>
      <pubDate>Wed, 12 May 2010 14:43:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Are-nested-loops-possible-using-JSL/m-p/1794#M1794</guid>
      <dc:creator />
      <dc:date>2010-05-12T14:43:43Z</dc:date>
    </item>
  </channel>
</rss>

