<?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: Row selection by value labels in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240256#M47474</link>
    <description>&lt;P&gt;thanks Mark.&amp;nbsp; I appreciate the quick response.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jan 2020 20:27:41 GMT</pubDate>
    <dc:creator>bfoulkes</dc:creator>
    <dc:date>2020-01-06T20:27:41Z</dc:date>
    <item>
      <title>Row selection by value labels</title>
      <link>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240243#M47472</link>
      <description>&lt;P&gt;I would like to script a row selection by the value labels in a column.&amp;nbsp; As an example, the Big Class data set has a value label where F=Female and M=Male.&amp;nbsp; As far I can tell, I cannot write JSL to do a column selection by "Female".&amp;nbsp; Does anyone know how to do this in JSL?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bfoulkes_0-1578339576381.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/20859i35B7EEF673AA0081/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bfoulkes_0-1578339576381.png" alt="bfoulkes_0-1578339576381.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My bigger issue is that I have several values that have the same label, but instead of trying to select all of those values individually, I would like to just select the label.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2020 19:44:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240243#M47472</guid>
      <dc:creator>bfoulkes</dc:creator>
      <dc:date>2020-01-06T19:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Row selection by value labels</title>
      <link>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240253#M47473</link>
      <description>&lt;P&gt;Use this example that illustrates one way to reverse the reference from the label to the value. (Note: I manually added the Value Label column property to the sex data column so that there was something to work with. That step is not included in the script. You shouldn't need it because your data column already has this property.)&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/Big Class.jmp" );

label = Arg( dt:sex &amp;lt;&amp;lt; Get Property( "Value Labels" ), 1 );

For( i = 1, i &amp;lt;= N Items( label ), i++,
	If( Contains(  Arg( label[i], 2 ), "female" ),
		value = Arg( label[i], 1 );
		Break();
	);
);

dt &amp;lt;&amp;lt; Select Where( :sex == value );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jan 2020 19:59:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240253#M47473</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-01-06T19:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Row selection by value labels</title>
      <link>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240256#M47474</link>
      <description>&lt;P&gt;thanks Mark.&amp;nbsp; I appreciate the quick response.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2020 20:27:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240256#M47474</guid>
      <dc:creator>bfoulkes</dc:creator>
      <dc:date>2020-01-06T20:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Row selection by value labels</title>
      <link>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240259#M47475</link>
      <description>&lt;P&gt;Here is a different take on a solution for your question.&amp;nbsp; The example jsl simply creates a new column that contains the Value Labels values, which then you can make your Select Where() functions from.&amp;nbsp; Since there is not a function to directly create the new column, the code uses a feature where JMP will move the value label form of a column if the column is copied to a JMP Journal.&amp;nbsp; See the code below for the details&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");

// Create the Value Labels for the Sample data table
dt:sex &amp;lt;&amp;lt; set property("value labels", {"F" = "Female", "M" = "Male"} );

// Select the column of interest
dt&amp;lt;&amp;lt;go to(:sex);

// Copy the column of interest into a journal
nwj = dt&amp;lt;&amp;lt;journal;

// Add a column to the existing data table, with the Value Labels as the 
// cell values for the new column
dt&amp;lt;&amp;lt;new column("Sex Label", character, values(nwj[stringColBox(1)]&amp;lt;&amp;lt;get));

// Close the no longer needed journal
nwj&amp;lt;&amp;lt;close window;

// Use the new label column for the row selection
dt &amp;lt;&amp;lt; select where(:Sex Label == "Female")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sexlabel.PNG" style="width: 590px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/20860i5A5A31AE15B16265/image-size/large?v=v2&amp;amp;px=999" role="button" title="sexlabel.PNG" alt="sexlabel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 01:20:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240259#M47475</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-01-07T01:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Row selection by value labels</title>
      <link>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240314#M47490</link>
      <description>This is also fantastic. I couldn't quite figure out how to grab the labels, but tossing them into a journal is brilliant. My actual dataset is over 2MM records and this goes 4X faster to complete. Thanks so much for sending this along.</description>
      <pubDate>Tue, 07 Jan 2020 13:12:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Row-selection-by-value-labels/m-p/240314#M47490</guid>
      <dc:creator>bfoulkes</dc:creator>
      <dc:date>2020-01-07T13:12:52Z</dc:date>
    </item>
  </channel>
</rss>

