<?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: Insert list of column names into a formula in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7683#M7677</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jeff.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Nov 2013 18:06:12 GMT</pubDate>
    <dc:creator>robot</dc:creator>
    <dc:date>2013-11-07T18:06:12Z</dc:date>
    <item>
      <title>Insert list of column names into a formula</title>
      <link>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7678#M7672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using JMP10.&amp;nbsp; I am trying to create a script to delete duplicate rows of data in a data table.&amp;nbsp; An example of my attempt is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Start.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create data table.&lt;/P&gt;&lt;P&gt;dt = open("$SAMPLE_DATA/Big Class.jmp");&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Select Randomly(5);&lt;/P&gt;&lt;P&gt;subdt = dt &amp;lt;&amp;lt; Subset(Output Table Name("subset"), Invisible);&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Concatenate(subdt, Append to First Table);&lt;/P&gt;&lt;P&gt;Close(subdt, No Save);&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Clear Select;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Find and delete duplicate rows for bigClass.&lt;/P&gt;&lt;P&gt;icol = dt &amp;lt;&amp;lt; New Column( "Index", Numeric, Continuous, Formula( Sequence( 1, N Row( dt ), 1, 1 ) ) );&lt;/P&gt;&lt;P&gt;repcol = dt &amp;lt;&amp;lt; New Column( "Repeat Data",&lt;/P&gt;&lt;P&gt;&amp;nbsp; Numeric,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Continuous,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Formula( If( :Index == Col Minimum( :Index, :name, :age, :sex, :height, :weight ), 1, 0 ) )&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Select Where( As Column(repcol) == 0 );&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Delete Rows();&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Delete Columns( {icol, repcol} );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Find and delete duplicate rows for generic data table.&lt;/P&gt;&lt;P&gt;colnames = dt &amp;lt;&amp;lt; Get Column Names();&lt;/P&gt;&lt;P&gt;icol = dt &amp;lt;&amp;lt; New Column( "Index", Numeric, Continuous, Formula( Sequence( 1, N Row( dt ), 1, 1 ) ) );&lt;/P&gt;&lt;P&gt;repcol = dt &amp;lt;&amp;lt; New Column( "Repeat Data",&lt;/P&gt;&lt;P&gt;&amp;nbsp; Numeric,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Continuous,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Formula( If( :Index == Col Minimum( :Index, /* Insert colnames here. */ ), 1, 0 ) )&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Select Where( As Column(repcol) == 0 );&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Delete Rows();&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Delete Columns( {icol, repcol} );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// End.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is I would like to make this script run on a generic data table.&amp;nbsp; How can I insert my colnames list into my formula?&amp;nbsp; Is there a more clever way to 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>Thu, 31 Oct 2013 20:48:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7678#M7672</guid>
      <dc:creator>robot</dc:creator>
      <dc:date>2013-10-31T20:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Insert list of column names into a formula</title>
      <link>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7679#M7673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant idea to use Col Min() to find duplicates!&lt;/P&gt;&lt;P&gt;Below is an alternative approach based on your idea that appears to work. It is simpler because there is no need for any temporary formula columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #009800;"&gt;// Create example data table.&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #a70096;"&gt;&lt;SPAN style="color: #2600eb;"&gt;Open&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;/SPAN&gt;"$SAMPLE_DATA/Big Class.jmp"&lt;SPAN style="color: #000000;"&gt; &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; Concatenate&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #2600eb;"&gt;Open&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;/SPAN&gt;"$SAMPLE_DATA/Big Class.jmp"&lt;SPAN style="color: #000000;"&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; Append to First Table &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #009800;"&gt;// Delete duplicates from generic table&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #2600eb;"&gt;&lt;SPAN style="color: #000000;"&gt;dt &lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;Current Data Table&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;()&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;col_min &lt;SPAN style="color: #150097;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #2600eb;"&gt;Parse&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #a70096;"&gt;"Col Min( Row(), :Name(\!""&lt;/SPAN&gt; &lt;SPAN style="color: #150097;"&gt;||&lt;/SPAN&gt; &lt;SPAN style="color: #2600eb;"&gt;Concat Items&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; dt &lt;SPAN style="color: #150097;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; get column names&lt;STRONG&gt;(&lt;/STRONG&gt; string &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #a70096;"&gt;"\!"), :Name(\!""&lt;/SPAN&gt; &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;SPAN style="color: #150097;"&gt;||&lt;/SPAN&gt; &lt;SPAN style="color: #a70096;"&gt;"\!"))"&lt;/SPAN&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;duplicates &lt;SPAN style="color: #150097;"&gt;=&lt;/SPAN&gt; &lt;STRONG&gt;[]&lt;/STRONG&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #2600eb;"&gt;For Each Row&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #2600eb;"&gt;If&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; col_min &lt;SPAN style="color: #150097;"&gt;!=&lt;/SPAN&gt; &lt;SPAN style="color: #2600eb;"&gt;Row&lt;/SPAN&gt;&lt;STRONG&gt;()&lt;/STRONG&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; duplicates &lt;SPAN style="color: #150097;"&gt;|/=&lt;/SPAN&gt; &lt;SPAN style="color: #2600eb;"&gt;Row&lt;/SPAN&gt;&lt;STRONG&gt;()&lt;/STRONG&gt; &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;dt &lt;SPAN style="color: #150097;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; delete rows&lt;STRONG&gt;(&lt;/STRONG&gt; duplicates &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Oct 2013 23:10:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7679#M7673</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2013-10-31T23:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Insert list of column names into a formula</title>
      <link>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7680#M7674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks MS!&amp;nbsp; Very clever.&amp;nbsp; I will still have to study exactly how it works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Oct 2013 23:50:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7680#M7674</guid>
      <dc:creator>robot</dc:creator>
      <dc:date>2013-10-31T23:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Insert list of column names into a formula</title>
      <link>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7681#M7675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was too quick. The first posted version would fail for complex column names that require the :Name("e.g. ∆X") construct. I edited the code above and now it should work more generally.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Nov 2013 00:27:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7681#M7675</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2013-11-01T00:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Insert list of column names into a formula</title>
      <link>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7682#M7676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is clever to use Col Min() with an index column to locate duplicates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I usually use Tables-&amp;gt;Summary to get a data table free of duplicates. Just Group by all of the columns that would define a duplicate. This has the added advantage of providing a column (N Rows) that tells you how many duplicate rows there were in the original table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="4480_JMPScreenSnapz001.png" style="width: 635px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/269i6A6C8FD32976DF40/image-size/medium?v=v2&amp;amp;px=400" role="button" title="4480_JMPScreenSnapz001.png" alt="4480_JMPScreenSnapz001.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Jeff &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 20:27:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7682#M7676</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2016-10-18T20:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: Insert list of column names into a formula</title>
      <link>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7683#M7677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jeff.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 18:06:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Insert-list-of-column-names-into-a-formula/m-p/7683#M7677</guid>
      <dc:creator>robot</dc:creator>
      <dc:date>2013-11-07T18:06:12Z</dc:date>
    </item>
  </channel>
</rss>

