<?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 can I make a conditional subset table without directly calling a column name? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-I-make-a-conditional-subset-table-without-directly/m-p/231163#M45846</link>
    <description>&lt;P&gt;It does seem odd, doesn't it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is all about context. For example, you might use this in a column formula:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Column("height") &amp;lt; 60, 0, 1 );&amp;nbsp;//&amp;nbsp;implicit&amp;nbsp;assignment&amp;nbsp;of&amp;nbsp;Row() =&amp;nbsp;current&amp;nbsp;row&amp;nbsp;number&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you might use it in the For Each Row() function to accomplish the same thing in a script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each Row(
	// implicit assignment of Row() = current row number
	If( Column("height" ) &amp;lt; 60,
		:status = "small",
		:status = "large"
	)
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The context of the column formula and the iteration above is such that JMP is implicitly setting the Row() function for you. So JMP uses that information to figure out where to get or store the value (i.e., which row). That is not the context of the general case here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtSubgroup = dt &amp;lt;&amp;lt; Subset(Rows(dt &amp;lt;&amp;lt; get rows where(Column("height") &amp;lt; 60)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The data table does not implicitly use the current row number when you tries to evaluate the comparison. You force it to by adding the empty subscript operator, [ ].&lt;/P&gt;</description>
    <pubDate>Mon, 28 Oct 2019 20:42:01 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2019-10-28T20:42:01Z</dc:date>
    <item>
      <title>How can I make a conditional subset table without directly calling a column name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-make-a-conditional-subset-table-without-directly/m-p/231122#M45836</link>
      <description>&lt;P&gt;The first 3 lines of this script create a new data table where heights are less than 60. This part runs fine.&lt;BR /&gt;&lt;SPAN style="font-family: inherit;"&gt;For the function that I would like to develop I would like to reference a column in a different way than using :height.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;I have tried 4 different ways to reference the column, but none of them work. I have used the column function and get column reference function (please see below).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//This one works
dtSubgroup = dt &amp;lt;&amp;lt; Subset(Rows(dt &amp;lt;&amp;lt; get rows where(:height &amp;lt; 60)));
//None of these work
dtSubgroup = dt &amp;lt;&amp;lt; Subset(Rows(dt &amp;lt;&amp;lt; get rows where(Column("height") &amp;lt; 60)));
dtSubgroup = dt &amp;lt;&amp;lt; Subset(Rows(dt &amp;lt;&amp;lt; get rows where(Column(dt, "height") &amp;lt; 60)));
dtSubgroup = dt &amp;lt;&amp;lt; Subset(Rows(dt &amp;lt;&amp;lt; get rows where(Column(4) &amp;lt; 60)));
refList = dt &amp;lt;&amp;lt; Get Column Reference( {"height"} );
dtSubgroup = dt &amp;lt;&amp;lt; Subset(Rows(dt &amp;lt;&amp;lt; get rows where(refList[1] &amp;lt; 60)));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there any reason why they do not work?&lt;BR /&gt;Any suggestion on a solution?&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 18:42:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-make-a-conditional-subset-table-without-directly/m-p/231122#M45836</guid>
      <dc:creator>Kelly</dc:creator>
      <dc:date>2019-10-28T18:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make a conditional subset table without directly calling a column name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-make-a-conditional-subset-table-without-directly/m-p/231148#M45841</link>
      <description>&lt;P&gt;Try appending empty square brackets after the closing parenthesis of the Column() function. Like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Column("height")[] &amp;lt; 60&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Does this change help?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 19:19:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-make-a-conditional-subset-table-without-directly/m-p/231148#M45841</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-10-28T19:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make a conditional subset table without directly calling a column name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-make-a-conditional-subset-table-without-directly/m-p/231150#M45842</link>
      <description>Thanks, this did exactly what I wanted.&lt;BR /&gt;May I ask why this works?&lt;BR /&gt;I have used the column function many times without using square brackets.&lt;BR /&gt;What is different about this case? What is the rule to follow?</description>
      <pubDate>Mon, 28 Oct 2019 20:00:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-make-a-conditional-subset-table-without-directly/m-p/231150#M45842</guid>
      <dc:creator>Kelly</dc:creator>
      <dc:date>2019-10-28T20:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make a conditional subset table without directly calling a column name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-make-a-conditional-subset-table-without-directly/m-p/231163#M45846</link>
      <description>&lt;P&gt;It does seem odd, doesn't it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is all about context. For example, you might use this in a column formula:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Column("height") &amp;lt; 60, 0, 1 );&amp;nbsp;//&amp;nbsp;implicit&amp;nbsp;assignment&amp;nbsp;of&amp;nbsp;Row() =&amp;nbsp;current&amp;nbsp;row&amp;nbsp;number&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you might use it in the For Each Row() function to accomplish the same thing in a script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each Row(
	// implicit assignment of Row() = current row number
	If( Column("height" ) &amp;lt; 60,
		:status = "small",
		:status = "large"
	)
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The context of the column formula and the iteration above is such that JMP is implicitly setting the Row() function for you. So JMP uses that information to figure out where to get or store the value (i.e., which row). That is not the context of the general case here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtSubgroup = dt &amp;lt;&amp;lt; Subset(Rows(dt &amp;lt;&amp;lt; get rows where(Column("height") &amp;lt; 60)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The data table does not implicitly use the current row number when you tries to evaluate the comparison. You force it to by adding the empty subscript operator, [ ].&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 20:42:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-make-a-conditional-subset-table-without-directly/m-p/231163#M45846</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-10-28T20:42:01Z</dc:date>
    </item>
  </channel>
</rss>

