<?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: How to subset a data table based on column value in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373142#M62301</link>
    <description>&lt;P&gt;Perhaps that example will work for you, BR&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 );
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );

dt_lst = dt &amp;lt;&amp;lt; Subset(
	By( :lot_id ),
	All rows,
	columns( :wafer, :Wafer ID in lot ID, :SITE, :NPN1, :PNP1, :PNP2, :NPN2, :PNP3 )
);

Wait( 1 );

For( i = 1, i &amp;lt;= N Items( dt_lst ), i++,
	Close( dt_lst[i], nosave );
	wait(0.2);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 31 Mar 2021 20:51:57 GMT</pubDate>
    <dc:creator>Georg</dc:creator>
    <dc:date>2021-03-31T20:51:57Z</dc:date>
    <item>
      <title>How to subset a data table based on column value</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373137#M62300</link>
      <description>&lt;P&gt;Hello!&amp;nbsp; I have a large JMP file which contains the stability testing results for many (&amp;gt;75 product lots).&amp;nbsp; I want to create a script to subset the rows of testing data based on the column value (i.e. the lot number) while only including certain test result columns from the file. I am fairly new to JMP and JMP scripting, but I have managed to put together the following script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "Stability Trending" ) &amp;lt;&amp;lt;
Subset(
	Output Table( "Data Subset - Lot 12345" ),
	Copy formula( 0 ),
	Selected Rows( 0 ),
	Rows(
		[1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325,
		1326, 1327, 1328, 1329]
	),
	columns(
		:Protocol No.,
		:Lot No.,
		:Final Fill Configuration,
		:Name( "Storage Temperature (°C)" ),
		:Time Point,
		:Time Interval,
		:Sterility Result,
		:Name( "Test 1 Result" ),
		:Name( "Test 2 Result" ),
		:pH Result,
		:Name( "Test 3 Result" ),
		:Name( "Test 4 Result" )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Right now, the script is selecting the rows based on the row numbers where the data for a particular lot is found.&amp;nbsp; This is not optimal as rows are sometimes inserted within the table as stability studies are modified.&amp;nbsp; How would I modify the script above to subset rows of "Lot 12345" based on the "Lot No." column rather than the row number?&amp;nbsp; I am using JMP 15 (in case that is important).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:28:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373137#M62300</guid>
      <dc:creator>KKlear</dc:creator>
      <dc:date>2023-06-10T23:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to subset a data table based on column value</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373142#M62301</link>
      <description>&lt;P&gt;Perhaps that example will work for you, BR&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 );
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );

dt_lst = dt &amp;lt;&amp;lt; Subset(
	By( :lot_id ),
	All rows,
	columns( :wafer, :Wafer ID in lot ID, :SITE, :NPN1, :PNP1, :PNP2, :NPN2, :PNP3 )
);

Wait( 1 );

For( i = 1, i &amp;lt;= N Items( dt_lst ), i++,
	Close( dt_lst[i], nosave );
	wait(0.2);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Mar 2021 20:51:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373142#M62301</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2021-03-31T20:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to subset a data table based on column value</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373166#M62302</link>
      <description>&lt;P&gt;I would recommend using Select Where function (found under Rows-&amp;gt;Rows Selection). Something similar to this should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "Stability Trending" ) &amp;lt;&amp;lt; Row Selection(
	Select where( :Lot No. == "Lot 12345" ),
	Dialog( Edit( Equal( Source Column( :Lot No. ) ) ), Keep dialog open( 0 ) )
);
Subset( (Selected Rows), Output Table Name( "Subset-Lot 12345" ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Mar 2021 22:36:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373166#M62302</guid>
      <dc:creator>cweisbart</dc:creator>
      <dc:date>2021-03-31T22:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to subset a data table based on column value</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373167#M62303</link>
      <description>&lt;P&gt;Made a typo (forgot to replace one of my column names with the column name "Lot No." in your example):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "Stability Trending" ) &amp;lt;&amp;lt; Row Selection(
	Select where( :Lot No. == "Lot 12345" ),
	Dialog( Edit( Equal( Source Column( :Lot No. ) ) ), Keep dialog open( 0 ) )
);
Subset( (Selected Rows), Output Table Name( "Subset-Lot 12345" ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Mar 2021 22:27:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373167#M62303</guid>
      <dc:creator>cweisbart</dc:creator>
      <dc:date>2021-03-31T22:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to subset a data table based on column value</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373168#M62304</link>
      <description>&lt;P&gt;Thanks for the suggestions everyone.&amp;nbsp; Here is what I ended up doing:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Data Table( "Stability Trending" );

LN={"Lot 12345"};

dt&amp;lt;&amp;lt;select where(contains(LN, Lot No.));

dt&amp;lt;&amp;lt;Subset(
	Output Table( "Data Subset - Lot 12345" ),
	Copy formula( 0 ),
	Selected Rows( 1 ),
	Columns(
		:Protocol No.,
		:Lot No.,
		:Final Fill Configuration,
		:Name( "Storage Temperature (°C)" ),
		:Time Point,
		:Time Interval,
		:Sterility Result,
		:Name( "Test 1 Result)" ),
		:Name( "Test 2 Result" ),
		:pH Result,
		:Name( "Test 3 Result" ),
		:Name( "Test 4 Result)" )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The resulting data table is giving me the output I was looking for - only the rows containing the lot number of interest and the test results from the columns I specified.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 22:41:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-subset-a-data-table-based-on-column-value/m-p/373168#M62304</guid>
      <dc:creator>KKlear</dc:creator>
      <dc:date>2021-03-31T22:41:10Z</dc:date>
    </item>
  </channel>
</rss>

