<?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 eliminate the first duplicate row? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108316#M39408</link>
    <description>&lt;P&gt;I actually first encountered JMP in 1994 at Uppsala university, Sweden and have used it ever since. Even if JMP is still not very commonly used in Swedish academia, I have "converted" quite a few SPSS users along the way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Agree, this community is great.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jan 2019 11:51:04 GMT</pubDate>
    <dc:creator>ms</dc:creator>
    <dc:date>2019-01-30T11:51:04Z</dc:date>
    <item>
      <title>How to eliminate the first duplicate row?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108278#M39389</link>
      <description>&lt;P&gt;Dear community I have a question and that is how to eliminate rows with the first duplicate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Nr&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4567&lt;/TD&gt;&lt;TD&gt;2017-01-21&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;5555&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;2017-02-03&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5555&lt;/TD&gt;&lt;TD&gt;2017-02-10&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8745&lt;/TD&gt;&lt;TD&gt;2015-03-10&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8345&lt;/TD&gt;&lt;TD&gt;2016-05-01&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;9563&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;2016-01-02&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9563&lt;/TD&gt;&lt;TD&gt;2016-01-10&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a script how to, in this example, find the duplicates that I have marked here with bold text and either eliminate these rows directly or create an additional column where it could be stated for example Keep and Eliminate?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using JMP Pro 14.0.0 (64-bit)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely yours&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lars Enochsson, M.D., Ph.D.&lt;/P&gt;&lt;P&gt;Professor of Surgery&lt;/P&gt;&lt;P&gt;Department of Surgical and Perioperative Sciences&lt;/P&gt;&lt;P&gt;Umeå University&lt;/P&gt;&lt;P&gt;Head of the Swedish Registry of Gallstone Surgery and ERCP, GallRiks&lt;/P&gt;&lt;P&gt;Scientific Secretary of the Swedish Surgical Society&lt;/P&gt;&lt;P&gt;E-mail: &lt;A href="mailto:lars.enochsson@umu.se" target="_blank" rel="noopener"&gt;lars.enochsson@umu.se&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 20:17:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108278#M39389</guid>
      <dc:creator>LarsBirger</dc:creator>
      <dc:date>2019-01-29T20:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to eliminate the first duplicate row?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108281#M39392</link>
      <description>&lt;P&gt;Hi Lars,&lt;/P&gt;
&lt;P&gt;Will duplicates always be sequentially ordered or could there be records between?&amp;nbsp; If they are always sequential like in your example, you could do something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
del_rows = {}; //initiate list to contain list of rows that are duplicates

for(i = 1, i&amp;lt;=N Row(dt), i++,
	if(:Nr[i] == :Nr[i+1], insert into(del_rows,i)) //if Nr for current row is same as next, then put current row in del_rows
);

dt &amp;lt;&amp;lt; Delete Rows(del_rows); //delete all rows in del_rows&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 21:03:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108281#M39392</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2019-01-29T21:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to eliminate the first duplicate row?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108283#M39394</link>
      <description>&lt;P&gt;Here is a script that will get the job done:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = New Table( "Example",
	Add Rows( 7 ),
	New Script(
		"Source",
		Data Table( "Transpose of Untitled 17" ) &amp;lt;&amp;lt;
		Subset( All rows, Selected columns only( 0 ) )
	),
	New Column( "Nr",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [4567, 5555, 5555, 8745, 8345, 9563, 9563] )
	),
	New Column( "Date",
		Numeric,
		"Continuous",
		Format( "yyyy-mm-dd", 12 ),
		Input Format( "yyyy-mm-dd" ),
		Set Values(
			[3567801600, 3568924800, 3569529600, 3508790400, 3544905600, 3534537600,
			3535228800]
		)
	),
	New Column( "Count",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 1, 2, 1, 1, 1, 2] )
	)
);

dt &amp;lt;&amp;lt; select duplicate rows( Match( :Nr ) );
wait(5);
dt2 = dt &amp;lt;&amp;lt; subset( invisible, selected rows( 1 ), selected columns( 0 ) );
dt &amp;lt;&amp;lt; delete rows;
Wait(5);
dt = dt &amp;lt;&amp;lt; Update( With( dt2 ), Match Columns( :Nr = :Nr ) );

Close( dt2, nosave );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Jan 2019 21:04:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108283#M39394</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-01-29T21:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to eliminate the first duplicate row?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108285#M39396</link>
      <description>&lt;P&gt;This script should work too:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Delete all multiplicate rows except the one with the latest date (sorting does not matter). 
dt = Current Data Table();
dt &amp;lt;&amp;lt; Select Where(Col Max(:Date, :Nr) &amp;gt; :Date);
dt &amp;lt;&amp;lt; Delete rows;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Edit: If duplicates can have the same date, this works better, but sorting by date required.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Select Where(Col Max(Row(), :Nr) &amp;gt; Row());
dt &amp;lt;&amp;lt; Delete Rows;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 22:16:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108285#M39396</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2019-01-29T22:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to eliminate the first duplicate row?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108310#M39404</link>
      <description>Thanks for the quick reply. This script really did the trick. There are not som many people in Sweden using JMP at least not in the academic world. Usually they use SPSS or Stata. However, with this active community there is no reason to change. Even our statistician up here at Umeå University is impressed./Lars</description>
      <pubDate>Wed, 30 Jan 2019 08:52:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108310#M39404</guid>
      <dc:creator>LarsBirger</dc:creator>
      <dc:date>2019-01-30T08:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to eliminate the first duplicate row?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108311#M39405</link>
      <description>Well, I appreciate the "Thanks".  I feel even better about responding to you, now that I know you are a fellow Scandinavian.  My Great Grandfather, Nels Knutson, immigrated to America from Bergan, Norway.</description>
      <pubDate>Wed, 30 Jan 2019 09:00:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108311#M39405</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-01-30T09:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to eliminate the first duplicate row?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108316#M39408</link>
      <description>&lt;P&gt;I actually first encountered JMP in 1994 at Uppsala university, Sweden and have used it ever since. Even if JMP is still not very commonly used in Swedish academia, I have "converted" quite a few SPSS users along the way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Agree, this community is great.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 11:51:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108316#M39408</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2019-01-30T11:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to eliminate the first duplicate row?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108341#M39418</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/182"&gt;@ms&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;Your years of experiece and knowlege with JMP are obvious in your Community Discussion responses.&amp;nbsp; I really appreciate your involvement in the Community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 16:01:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-eliminate-the-first-duplicate-row/m-p/108341#M39418</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-01-30T16:01:10Z</dc:date>
    </item>
  </channel>
</rss>

