<?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 How to use column name as a variable. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/5795#M5794</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to select some rows from a column ( I have a column named as 'RESOLUTION' in the current data table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This two lines will work:&lt;/P&gt;&lt;P&gt;======================================&lt;/P&gt;&lt;P&gt;dt = Current Data Table();&lt;/P&gt;&lt;P&gt;dt&amp;lt;&amp;lt;Select Where(RESOLUTION &amp;gt; 0.);&lt;/P&gt;&lt;P&gt;======================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I define 'RESOLUTION' as another variable, it doesn't work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;============================================&lt;/P&gt;&lt;P&gt;dt = Current Data Table();&lt;/P&gt;&lt;P&gt;colA="RESOLUTION";&lt;/P&gt;&lt;P&gt;dt&amp;lt;&amp;lt;Select Where(column(dt, colA) &amp;gt; 0.);&lt;/P&gt;&lt;P&gt;============================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will not select any row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone kindly tell me how could I do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Oct 2012 23:36:47 GMT</pubDate>
    <dc:creator>qt</dc:creator>
    <dc:date>2012-10-17T23:36:47Z</dc:date>
    <item>
      <title>How to use column name as a variable.</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/5795#M5794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to select some rows from a column ( I have a column named as 'RESOLUTION' in the current data table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This two lines will work:&lt;/P&gt;&lt;P&gt;======================================&lt;/P&gt;&lt;P&gt;dt = Current Data Table();&lt;/P&gt;&lt;P&gt;dt&amp;lt;&amp;lt;Select Where(RESOLUTION &amp;gt; 0.);&lt;/P&gt;&lt;P&gt;======================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I define 'RESOLUTION' as another variable, it doesn't work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;============================================&lt;/P&gt;&lt;P&gt;dt = Current Data Table();&lt;/P&gt;&lt;P&gt;colA="RESOLUTION";&lt;/P&gt;&lt;P&gt;dt&amp;lt;&amp;lt;Select Where(column(dt, colA) &amp;gt; 0.);&lt;/P&gt;&lt;P&gt;============================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will not select any row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone kindly tell me how could I do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 23:36:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/5795#M5794</guid>
      <dc:creator>qt</dc:creator>
      <dc:date>2012-10-17T23:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use column name as a variable.</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/5796#M5795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;qt,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will do the trick. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;dt &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000dd;"&gt;Current Data Table&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10.0pt; font-family: 'Courier New';"&gt;()&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;colA &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple;"&gt;"Resolution"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;col_expr &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple;"&gt;"dt &amp;lt;&amp;lt; Select Where(:name(\!""&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;||&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt; colA &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;||&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple;"&gt;"\!") &amp;gt; 0.)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000dd;"&gt;eval&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10.0pt; font-family: 'Courier New';"&gt;(&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000dd;"&gt;parse&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10.0pt; font-family: 'Courier New';"&gt;(&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;col_expr&lt;STRONG&gt;))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically you're creating some dynamic code, and then executing it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 20:24:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/5796#M5795</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2012-10-18T20:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use column name as a variable.</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/5797#M5796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 20:58:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/5797#M5796</guid>
      <dc:creator>qt</dc:creator>
      <dc:date>2012-10-18T20:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use column name as a variable.</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/5798#M5797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alternatively use the AsColumn function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;colA="RESOLUTION";&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;dt&amp;lt;&amp;lt;Select Where(AsColumn(colA) &amp;gt; 0.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 21:07:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/5798#M5797</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2012-10-18T21:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use column name as a variable.</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/394604#M64501</link>
      <description>&lt;P&gt;One thing to watch with using As Column() is that it seems to be much slower than using the eval( parse(..)) syntax for a large data table.&lt;/P&gt;&lt;P&gt;In my case I had a data table with 390k rows and 17 columns.&lt;/P&gt;&lt;P&gt;Using Eval ( Parse ( .... )) took 67 msec to select the rows I was looking for while using the As Column() syntax took 3,600 msec !&amp;nbsp; ( using HPTime() to measure )&lt;/P&gt;&lt;P&gt;So while the As Column() syntax is a whole lot more readable in the code, if speed matters, it may not be the best option&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 20:00:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/394604#M64501</guid>
      <dc:creator>tsl</dc:creator>
      <dc:date>2021-06-18T20:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use column name as a variable.</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/394607#M64502</link>
      <description>&lt;P&gt;It might make AsColumn() faster if you combine it with Column().&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Should-you-Loop-through-a-data-table-or-use-Recode-or-use-Get/m-p/381444/highlight/true#M63199" target="_self"&gt;Re: Should you Loop through a data table or use Recode, or use Get Rows Where to change values in a data table&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 20:35:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-column-name-as-a-variable/m-p/394607#M64502</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-06-18T20:35:19Z</dc:date>
    </item>
  </channel>
</rss>

