<?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: Deleting the second duplicate row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494977#M130555</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
by  customer_id	customer_name notsorted;
if first.customer_id and first.customer_name;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You don't need to reference both of those FIRST. variables.&amp;nbsp; &amp;nbsp;If you want to keep multiple names per CUSTOMER_ID then just use FIRST.CUSTOMER_NAME.&amp;nbsp; If you just want one name per customer_id the just use use FIRST.CUSTOMER_ID.&amp;nbsp; Note that FIRST.CUSTOMER_NAME will always be true when FIRST.CUSTOMER_ID is true.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Sep 2018 18:54:10 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-09-12T18:54:10Z</dc:date>
    <item>
      <title>Deleting the second duplicate row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494972#M130551</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;customer_id&lt;/TD&gt;&lt;TD&gt;customer_name&lt;/TD&gt;&lt;TD&gt;visit&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;456A&lt;/TD&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;123B&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Smith&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;123B&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Smith&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;987D&lt;/TD&gt;&lt;TD&gt;David&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;654H&lt;/TD&gt;&lt;TD&gt;Haydar&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to delete the second row for Smith, because customer_id and customer_name are the same. In other words: only keep the first instance of visit. What I want is like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;customer_id&lt;/TD&gt;&lt;TD&gt;customer_name&lt;/TD&gt;&lt;TD&gt;visit&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;456A&lt;/TD&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;123B&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Smith&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;987D&lt;/TD&gt;&lt;TD&gt;David&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;654H&lt;/TD&gt;&lt;TD&gt;Haydar&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:44:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494972#M130551</guid>
      <dc:creator>altijani</dc:creator>
      <dc:date>2018-09-12T18:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting the second duplicate row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494974#M130553</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
by  customer_id	customer_name notsorted;
if first.customer_id and first.customer_name;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494974#M130553</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-12T18:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting the second duplicate row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494977#M130555</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
by  customer_id	customer_name notsorted;
if first.customer_id and first.customer_name;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You don't need to reference both of those FIRST. variables.&amp;nbsp; &amp;nbsp;If you want to keep multiple names per CUSTOMER_ID then just use FIRST.CUSTOMER_NAME.&amp;nbsp; If you just want one name per customer_id the just use use FIRST.CUSTOMER_ID.&amp;nbsp; Note that FIRST.CUSTOMER_NAME will always be true when FIRST.CUSTOMER_ID is true.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494977#M130555</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-12T18:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting the second duplicate row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494979#M130556</link>
      <description>&lt;P&gt;Oh yes of course. Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494979#M130556</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-12T18:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting the second duplicate row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494993#M130563</link>
      <description>&lt;P&gt;I need to keep the first observation of the same customer_id and customer_name&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 19:23:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-the-second-duplicate-row/m-p/494993#M130563</guid>
      <dc:creator>altijani</dc:creator>
      <dc:date>2018-09-12T19:23:59Z</dc:date>
    </item>
  </channel>
</rss>

