<?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: subset in JSL -syntax issue in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/856149#M102699</link>
    <description>&lt;P&gt;I usually use Rows() when subsetting specific rows (you can also subset selected rows, but usually you end up performing unnecessary selects in the table when doing this).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This example will subset all rows which have sex == "F"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

rows_to_subset = dt &amp;lt;&amp;lt; get rows where(:sex == "F");

dt_subset = dt &amp;lt;&amp;lt; Subset(Rows(rows_to_subset), Output Table("Subset F"));&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 27 Mar 2025 14:23:31 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-03-27T14:23:31Z</dc:date>
    <item>
      <title>subset in JSL -syntax issue</title>
      <link>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/856138#M102697</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I'm trying to &lt;SPAN&gt;subset all the data in the row which the value in column: " is rejects?"&amp;nbsp; ==Y to new table called rejects&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I try several ways but non of them working and I get the error:&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;"Unexpected "Split_dt". Perhaps there is a missing ";" or ",".&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Line 77 Column 1: ►Split_dt &amp;lt;&amp;lt; Select Where( :is rejects? == "Y" );"&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;this code is part of larger script that create the column :"&lt;EM&gt;is rejects?"&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;when I run the all script I get the error above, but when I run it separately it is working.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;what can I do to fix it?&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;option1:&lt;/U&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;rejects = Split_dt &amp;lt;&amp;lt; Subset(
	Where(:is rejects? == "Y"),
	Output Table Name("rejects"),
	All Columns
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;U&gt;option2:&lt;/U&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Split_dt &amp;lt;&amp;lt; Select Where(:is rejects? == "Y");
rejects = Split_dt &amp;lt;&amp;lt; Subset(Output Table Name("rejects"), All Columns);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;the full script:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Split_dt = Current Data Table();

Split_dt &amp;lt;&amp;lt; New Column("is rejects?", character, Formula("N"));
Column(Split_dt, "is rejects?") &amp;lt;&amp;lt; Delete Formula;

// Get the number of columns in the data table
numCols = N Cols(Split_dt);

// Iterate over each row in the data table
For Each Row(
// Iterate over each column starting from column 6
	For(colIndex = 6, colIndex &amp;lt;= numCols, colIndex++, 
// Get the column reference
		currentCol = Column(Split_dt, colIndex);
// Check if the value in the current cell is greater than 100 and "is rejects?" is "N"
		If(
			currentCol[] &amp;gt; 100 &amp;amp; :is rejects? == "N" &amp;amp; Contains(currentCol &amp;lt;&amp;lt; Get Name, "BI")
			 == 0, 
// Change the value in the "is rejects?" column to "Y"
			:is rejects? = "Y";
// Exit the loop early since we only need one match
			Break();
		);
	)
);


rejects = Split_dt &amp;lt;&amp;lt; Subset(
	Where(:is rejects? == "Y"),
	Output Table Name("rejects"),
	All Columns
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 14:21:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/856138#M102697</guid>
      <dc:creator>ShirAlpert20</dc:creator>
      <dc:date>2025-03-27T14:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: subset in JSL -syntax issue</title>
      <link>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/856149#M102699</link>
      <description>&lt;P&gt;I usually use Rows() when subsetting specific rows (you can also subset selected rows, but usually you end up performing unnecessary selects in the table when doing this).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This example will subset all rows which have sex == "F"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

rows_to_subset = dt &amp;lt;&amp;lt; get rows where(:sex == "F");

dt_subset = dt &amp;lt;&amp;lt; Subset(Rows(rows_to_subset), Output Table("Subset F"));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Mar 2025 14:23:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/856149#M102699</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-03-27T14:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: subset in JSL -syntax issue</title>
      <link>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/862658#M102734</link>
      <description>&lt;P&gt;thank you for the quick response.&lt;BR /&gt;the solution you suggested give the same error :(&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 06:11:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/862658#M102734</guid>
      <dc:creator>ShirAlpert20</dc:creator>
      <dc:date>2025-03-31T06:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: subset in JSL -syntax issue</title>
      <link>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/862659#M102735</link>
      <description>&lt;P&gt;Which JMP version are you using? Did you try my example script?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 06:13:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/862659#M102735</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-03-31T06:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: subset in JSL -syntax issue</title>
      <link>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/863168#M102737</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;rejects = Split_dt &amp;lt;&amp;lt; Subset(
	Filtered Rows(:is rejects? == "Y"),
	Output Table Name("rejects"),
	All Columns
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Mar 2025 10:00:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/subset-in-JSL-syntax-issue/m-p/863168#M102737</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-03-31T10:00:42Z</dc:date>
    </item>
  </channel>
</rss>

