<?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: SAS to JSL - Do Loops... in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452832#M69968</link>
    <description>&lt;P&gt;This is great Craige_HALES!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I very much appreciate you taking time to explain.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jan 2022 22:13:05 GMT</pubDate>
    <dc:creator>fat_angus</dc:creator>
    <dc:date>2022-01-20T22:13:05Z</dc:date>
    <item>
      <title>SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452488#M69921</link>
      <description>&lt;P&gt;I am a long time SAS user being forced to learn JSL...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Things I found easy in SAS seem so difficult in JSL...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could someone show me how Do Loops work in JSL by sharing with me JSL code that would generate the following nested do loop table using JSL?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data frustration;
&amp;nbsp; do temp = 1 to 10 by 1;
&amp;nbsp; &amp;nbsp; &amp;nbsp;do press = 5 to 20 by 5;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;do time = 1 to 1000 by 20;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;output;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end;
&amp;nbsp; &amp;nbsp; end;
&amp;nbsp; end;
run;&lt;/PRE&gt;
&lt;P&gt;This should be fairly simple to create these types of simulations but I can't seem to figure this out.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:09:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452488#M69921</guid>
      <dc:creator>fat_angus</dc:creator>
      <dc:date>2023-06-09T18:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452510#M69923</link>
      <description>&lt;P&gt;You've come to the right place for assistance learning JSL.&amp;nbsp; The scripting index is your friend, as is the on-line documentation.&lt;/P&gt;
&lt;P&gt;Here's a code snippet that does what you want:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = data table("frustration");
for (temp = 1, temp &amp;lt;= 10, temp++,
	for (press = 5, press &amp;lt;= 20, press+=5,
		for (time = 1, time &amp;lt;= 1000, time+=20,
			show(temp, press, time);	// output
		);
	);
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jan 2022 20:14:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452510#M69923</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2022-01-19T20:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452604#M69927</link>
      <description>&lt;P&gt;All of this is covered in the Scripting Guide, which I very, very strongly recommend you read.&amp;nbsp; It is available in the JMP Documentation Library, available under the Help pull down menu in JMP.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 23:07:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452604#M69927</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-01-19T23:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452649#M69932</link>
      <description>&lt;P&gt;&lt;LI-MESSAGE title="C++ Programmer's Guide to JSL" uid="42309" url="https://community.jmp.com/t5/JSL-Cookbook/C-Programmer-s-Guide-to-JSL/m-p/42309#U42309" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp; might be of some help too. It tries to show how the JSL for statement is really a function, and knowing that will make it a lot easier to get the syntax right.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 03:39:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452649#M69932</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-01-20T03:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452658#M69936</link>
      <description>&lt;P&gt;Thanks for the help pmroz&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 12:40:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452658#M69936</guid>
      <dc:creator>fat_angus</dc:creator>
      <dc:date>2022-01-20T12:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452659#M69937</link>
      <description>&lt;P&gt;I hear what you are saying... thank you... but, it's kind of like someone telling you to read the Bible to understand Christianity....I spent about 2 hours in the scripting guide looking for how to do this seemingly easy concept... additionally, I have had lots of success writing other scripts... but honestly, the scripting guide makes me yearn for an additional 20k in the budget for a SAS license.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not a hardcore coder... I am an engineer just trying to get stuff done fast.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 12:43:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452659#M69937</guid>
      <dc:creator>fat_angus</dc:creator>
      <dc:date>2022-01-20T12:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452660#M69938</link>
      <description>&lt;P&gt;THank you... this is helpful.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 12:44:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452660#M69938</guid>
      <dc:creator>fat_angus</dc:creator>
      <dc:date>2022-01-20T12:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452673#M69940</link>
      <description>&lt;P&gt;I find it easier to learn by example, so look at as much code as you can find in this forum.&amp;nbsp; Once you get going the scripting index will truly be your friend.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The JSL&amp;nbsp;&lt;STRONG&gt;for&lt;/STRONG&gt; loops and &lt;STRONG&gt;if&lt;/STRONG&gt; statement, although simple in concept, were a bit baffling to me initially.&amp;nbsp; To shorten your learning curve about &lt;STRONG&gt;if&lt;/STRONG&gt;, remember that it is a function, and the comma represents &lt;STRONG&gt;then&lt;/STRONG&gt;,&amp;nbsp;&lt;STRONG&gt;else if&lt;/STRONG&gt; and &lt;STRONG&gt;else&lt;/STRONG&gt;.&amp;nbsp; Open a script window (&lt;STRONG&gt;ctrl-T&lt;/STRONG&gt;), right-click in the window and select &lt;STRONG&gt;Show Embedded Log&lt;/STRONG&gt;.&amp;nbsp; Paste the below code in and click &lt;STRONG&gt;ctrl-R&lt;/STRONG&gt; to run it.&amp;nbsp; Play around with different values for a, b and c to see what happens.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a = 1;
b = 2;
c = 1;

if (a == b,
// then
	print("a is equal to b");
	,
// else if
	a == c,
// then
	print("a is equal to c");
	,
// else
	print("No match found for a");
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 14:32:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452673#M69940</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2022-01-20T14:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452674#M69941</link>
      <description>&lt;P&gt;A complete example, appreciating how hard it is to get started in a new language. (The help-&amp;gt;scripting index and the online help are complementary resources. I mostly use the help-&amp;gt;scripting index, for reminding me how it works. The online help might be better for starting out.) I put a little more here than just needed. I've forgotten SAS rules for case of names...&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 );
// what does that mean? JSL has several namespaces; the 'here' namespace is for this
// editor window and means 'press' is really 'here:press' but 'dtFrustration:press' belongs to
// the table's namespace (of column names.) You could also just use different names,
// like 'iPress' for the loop control variable. JMP's variable names are almost never
// case sensitive, the weird exception being column names, which are only sensitive &lt;BR /&gt;// if both 'Age' and 'age' are columns...Don't do that!

// an easy way to get this table script is to make a new table with the
// JMP GUI, then use the top-left red triangle to 'Copy Table Script (No Data)'.
// By convention, JSL uses 'dt' in the variable name that holds a handle to a table.
dtFrustration = New Table( "frustration",
    New Column( "temp" ), // continuous numeric by default
    New Column( "press" ),
    New Column( "time" )
);

// because the table might be linked to other reports, there
// is a lot of hidden messaging when the table changes. A lot.
// The messaging can be shut off and later enabled for a nice speedup.
// (to see it take longer, rerun just the loop below.)
// dtFrustration &amp;lt;&amp;lt; BeginDataUpdate; // pair with EndDataUpdate, below

For( temp = 1, temp &amp;lt;= 10, temp++,
    For( press = 5, press &amp;lt;= 20, press += 5,
        For( time = 1, time &amp;lt;= 1000, time += 20,
            dtFrustration &amp;lt;&amp;lt; addrows( 1 );
            dtFrustration:time = time;
            dtFrustration:temp = temp;
            dtFrustration:press = press;
        )
    )
);

// dtFrustration &amp;lt;&amp;lt; EndDataUpdate;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jan 2022 14:18:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452674#M69941</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-01-20T14:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452831#M69967</link>
      <description>&lt;P&gt;Thanks SUPER USER PMROZ once again; this is helpful.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 22:11:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452831#M69967</guid>
      <dc:creator>fat_angus</dc:creator>
      <dc:date>2022-01-20T22:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452832#M69968</link>
      <description>&lt;P&gt;This is great Craige_HALES!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I very much appreciate you taking time to explain.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 22:13:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452832#M69968</guid>
      <dc:creator>fat_angus</dc:creator>
      <dc:date>2022-01-20T22:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452844#M69970</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26014"&gt;@fat_angus&lt;/a&gt;, welcome to being a JMP user and to the JMP User Community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a longtime SAS programmer (I am one myself) you'll need to think about JMP and JSL very differently from the way you think about SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, you posted a question about a SAS DATA step. As you know, the DATA step is all about creating a SAS data set. There is no direct equivalent for the DATA step in JSL since JSL is mostly about automating the things you would do interactively in JMP.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For that reason, I always encourage people to make sure they have a good foundation in using JMP interactively before they begin thinking about what tasks they wan to automate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, to create the data table you create in your DATA step, I would create a File-&amp;gt;New Table...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/about-the-column-info-window.shtml#" target="_self"&gt;Cols-&amp;gt;New Columns...&lt;/A&gt; to add a new column and give it &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/create-formulas-in-jmp.shtml#" target="_self"&gt;a formula&lt;/A&gt; using the &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/row-functions.shtml" target="_self"&gt;Sequence()&lt;/A&gt; function.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022-01-20_17-37-56.951.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39145iCDC9737817F8FEA2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2022-01-20_17-37-56.951.png" alt="2022-01-20_17-37-56.951.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Temp column" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39144i237F91A007076C1C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2022-01-20_17-33-58.694.png" alt="Temp column" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Temp column&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I'd do the same for the other columns.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="press column" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39147i59319241FB33883A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2022-01-20_17-39-52.831.png" alt="press column" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;press column&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="time column" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39146iA15A75B3DCAEA174/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2022-01-20_17-40-25.634.png" alt="time column" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;time column&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After adding rows to the data table you'll end up with this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022-01-20_17-42-26.079.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39148i5BA2E5E624C9A12C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2022-01-20_17-42-26.079.png" alt="2022-01-20_17-42-26.079.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;When you're ready you can go to the red triangle next to the data table's name and Copy Table Script.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022-01-20_17-43-42.929.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39149i2BA323927779988B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2022-01-20_17-43-42.929.png" alt="2022-01-20_17-43-42.929.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;That will give you the following script to create a New Table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "untitled",
	Add Rows( 2000 ),
	New Column( "temp",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Sequence( 1, 10, 1, 200 ) )
	),
	New Column( "press",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Sequence( 5, 20, 5, 50 ) )
	),
	New Column( "time",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Sequence( 1, 1000, 20 ) ),
	)
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There are, of course, other interactive ways to get the table you've described in your DATA step. You could create three tables with your sequences and then use &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/join-data-tables.shtml#" target="_self"&gt;Tables-&amp;gt;Join&lt;/A&gt; and a couple of&amp;nbsp;&lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/join-data-tables.shtml#ww339235" target="_self"&gt;Cartesian Joins&lt;/A&gt;&amp;nbsp;to get the same table. When you're ready JMP can give you the scripts for those steps along the way.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless, it all starts with understanding how to use JMP and especially data tables interactively before you think about scripting it. After all, you don't know what's necessary to script until you know what JMP can with built-in tools already.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Keep learning and keep asking questions here in the Community. We're happy to help!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 20:14:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/452844#M69970</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2022-02-10T20:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to JSL - Do Loops...</title>
      <link>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/460034#M70494</link>
      <description>&lt;P&gt;Jeff - so sorry to be late to this. You went above and beyond with this reply and I thank you. Reason I haven't checked back is because I was able to get it to work as I wanted. Thanks very much for the explanation of JSL and SAS differences. It was really helpful&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 20:03:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SAS-to-JSL-Do-Loops/m-p/460034#M70494</guid>
      <dc:creator>fat_angus</dc:creator>
      <dc:date>2022-02-10T20:03:54Z</dc:date>
    </item>
  </channel>
</rss>

