<?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: Observation number of duplicate record in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184461#M34988</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No scdent, I want the obswervation number of duplicate record. If you look at my source. First observation is repeated at row number 4 thats what I need to put in variable &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Dup_row_num&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Jul 2014 03:46:36 GMT</pubDate>
    <dc:creator>yashpande</dc:creator>
    <dc:date>2014-07-18T03:46:36Z</dc:date>
    <item>
      <title>Observation number of duplicate record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184459#M34986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is there a way to find out the observation number of duplicate record . I tried with _n_ but somehow am unable to find the exact row number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need some help in that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data source;&lt;/P&gt;&lt;P&gt;input a b c d;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 2 3 4&lt;/P&gt;&lt;P&gt;5 6 7 8&lt;/P&gt;&lt;P&gt;9 10 11 12&lt;/P&gt;&lt;P&gt;1 2 3 4&lt;/P&gt;&lt;P&gt;9 10 11 12&lt;/P&gt;&lt;P&gt;5 6 7 8&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want target as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="355"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" width="64"&gt;a&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="64"&gt;b&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="64"&gt;c&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="64"&gt;d&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="99"&gt;Dup_row_num&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;7&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;9&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;11&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;12&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried following , I know I need to combine these two queries but somehow is unable to find it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table t1 as &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select monotonic() as row_number,a,b,c,d&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; from source &lt;/P&gt;&lt;P&gt;;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select max(row_number)&amp;nbsp; from&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;select count(*) as cnt, a,b,c,d, row_number from t1 group by a,b,c,d &lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 03:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184459#M34986</guid>
      <dc:creator>yashpande</dc:creator>
      <dc:date>2014-07-18T03:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Observation number of duplicate record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184460#M34987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;*Method 1;&lt;/P&gt;&lt;P&gt;proc sort data=Source out=A1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by a b c d;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Result(rename=(Cnt=Dup_row_num));&lt;/P&gt;&lt;P&gt;&amp;nbsp; set A1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by a b c d;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain Cnt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.d then Cnt=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Cnt+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.d &amp;amp; 0&amp;lt;Cnt then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Method 2;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table Result(where=(1&amp;lt;Dup_row_num))&lt;/P&gt;&lt;P&gt;&amp;nbsp; as select a, b, c, d, count(*) as Dup_row_num from Source group by a,b,c,d;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 03:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184460#M34987</guid>
      <dc:creator>scdent</dc:creator>
      <dc:date>2014-07-18T03:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Observation number of duplicate record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184461#M34988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No scdent, I want the obswervation number of duplicate record. If you look at my source. First observation is repeated at row number 4 thats what I need to put in variable &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Dup_row_num&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 03:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184461#M34988</guid>
      <dc:creator>yashpande</dc:creator>
      <dc:date>2014-07-18T03:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Observation number of duplicate record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184462#M34989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry ! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data T1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set Source;&lt;/P&gt;&lt;P&gt;&amp;nbsp; row_number=_n_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=T1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by a b c d row_number;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Result(rename=(row_number=dup_row_number));&lt;/P&gt;&lt;P&gt;&amp;nbsp; set T1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by a b c d row_number;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.d=0 &amp;amp; last.d=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 04:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184462#M34989</guid>
      <dc:creator>scdent</dc:creator>
      <dc:date>2014-07-18T04:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Observation number of duplicate record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184463#M34990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to get the grouping variables in your selected list of variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; t1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; row_number+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; a b c d;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1 2 3 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;5 6 7 8&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;9 10 11 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1 2 3 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;9 10 11 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;5 6 7 8&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; a,b,c,d&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , min(row_number) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; first_row&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , max(row_number) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; last_dup_row&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; t1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;group&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; a,b,c,d&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;having&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; count(*) &amp;gt; &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;order&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; a,b,c,d&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 04:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Observation-number-of-duplicate-record/m-p/184463#M34990</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-18T04:25:42Z</dc:date>
    </item>
  </channel>
</rss>

