<?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: Add &amp; Delete the Duplicate records in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178337#M45552</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Team,&lt;/P&gt;&lt;P&gt;As per &lt;STRONG style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="1088" data-externalid="" data-presence="null" data-userid="149594" data-username="art297" href="https://communities.sas.com/people/art297" id="jive-14959440342240294444186" style="padding: 0 3px 0 0; font-weight: inherit; font-style: inherit; font-size: 1.1em; font-family: inherit; color: #0e66ba;"&gt;Arthur&lt;/A&gt;&lt;/STRONG&gt;'s solutions the below code will fetch what i want&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;/*Collapse the modified data*/&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;proc summary data=need nway;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp; var amount;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp; class pol_id;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp; output out=want (drop=_:)sum=;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;run;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;But the output contains only pol_id and amount variable,&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;I would like to have all the variable &lt;/P&gt;&lt;P class="jive-thread-reply-btn" style="margin: 26px 0 -10px; font-size: 0.9em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;DIV class="jive-thread-reply-btn-correct" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/thread/71507" style="margin: 0 20px 0 0; padding: 2px 14px 4px 28px; font-weight: bold; font-style: inherit; font-family: inherit; color: #0e66ba; background-color: #f3f3f3;"&gt;Add &amp;amp; Delete the Duplicate records&lt;/A&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Feb 2015 15:18:00 GMT</pubDate>
    <dc:creator>avinashns</dc:creator>
    <dc:date>2015-02-26T15:18:00Z</dc:date>
    <item>
      <title>Add &amp; Delete the Duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178329#M45544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a sas dataset with around 30 variables, Out of which mainly i have concentrate on two variables shown below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;POL_ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amount&lt;/P&gt;&lt;P&gt;-----------------------------------&lt;/P&gt;&lt;P&gt;AZN123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $25&lt;/P&gt;&lt;P&gt;ABN456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $44&lt;/P&gt;&lt;P&gt;AZP123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $50&lt;/P&gt;&lt;P&gt;ABC456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $20&lt;/P&gt;&lt;P&gt;CRG020&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $60&lt;/P&gt;&lt;P&gt;AZC123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $15&lt;/P&gt;&lt;P&gt;ABP456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $10&lt;/P&gt;&lt;P&gt;NYP020&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $50&lt;/P&gt;&lt;P&gt;HRG090&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Conditions:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1) Eliminate Duplicate records&lt;/P&gt;&lt;P&gt;a)Eliminate records with AZN and retain the record with AZC.&lt;/P&gt;&lt;P&gt;b) Eliminate records with AZP and retain the record with AZC.&lt;/P&gt;&lt;P&gt;c) Eliminate records with ABN and retain the record with ABC&lt;/P&gt;&lt;P&gt;d) Eliminate records with ABP and retain the record with ABC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Combine Premium&lt;/P&gt;&lt;P&gt;Combine the Amount from the A_N and A_P records with the A_C record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note: S/w: SAS9.3, O/S: Linux&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Expected Output(order doesn't matter):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;POL_ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amount&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-------------------------------------&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;AZC123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $90&lt;/P&gt;&lt;P&gt;ABC456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $74&lt;/P&gt;&lt;P&gt;NY020&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $50&lt;/P&gt;&lt;P&gt;CRG020&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $60&lt;/P&gt;&lt;P&gt;HRG090&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $10&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Feb 2015 15:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178329#M45544</guid>
      <dc:creator>avinashns</dc:creator>
      <dc:date>2015-02-21T15:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Add &amp; Delete the Duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178330#M45545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this will get rid of records with duplicate POL_ID:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=mydata nodupkey;&lt;/P&gt;&lt;P&gt;by POL_ID;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CAUTION: this will get rid of records that have the same POL_ID even if the amounts are different.&amp;nbsp; Is this what&amp;nbsp; you want to happen?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Feb 2015 17:01:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178330#M45545</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2015-02-21T17:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Add &amp; Delete the Duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178331#M45546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gregg,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No, Thats not i am expecting,&lt;/P&gt;&lt;P&gt;What i am thinking is,&lt;/P&gt;&lt;P&gt;split the POL_ID in to two parts as prifex=first 3 char of POLID , ID=rest of the char (example prefix=AZN, ID=123)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=inputdata;&lt;/P&gt;&lt;P&gt;by ID Prefix;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;Here AZC,AZN &amp;amp; AZP has same ID which is 123, Now &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Combine the Amount from the A_N and A_P records with the A_C record. and remove AZP &amp;amp; AZN records from the dataset, So that out of 3 only one records remains i.e AZC123 with total sum.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We can use the&amp;nbsp; FIRST.VAR and retain logic, Expecting the better approach from you all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it give a clear picture, Let me know if you need any more information..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Feb 2015 17:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178331#M45546</guid>
      <dc:creator>avinashns</dc:creator>
      <dc:date>2015-02-21T17:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add &amp; Delete the Duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178332#M45547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First.Var/Last.var and retain logic would be the solution I would recommend.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because you have to split the ID and perform summation other procs will require pre-processing of the data which means multiple data passes. A data step would be a single pass with a pre-sort. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Feb 2015 21:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178332#M45547</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-21T21:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add &amp; Delete the Duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178333#M45548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to retain the record for multiple iteration,&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Prefix&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amount&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; V1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; V2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; V3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; V4 ....... V30&lt;/P&gt;&lt;P&gt;123&amp;nbsp;&amp;nbsp; ABC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; w&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y&lt;/P&gt;&lt;P&gt;123&amp;nbsp;&amp;nbsp; ABN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g&lt;/P&gt;&lt;P&gt;123&amp;nbsp;&amp;nbsp; ABP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Required Output:&lt;/P&gt;&lt;P&gt;123&amp;nbsp;&amp;nbsp;&amp;nbsp; ABC&amp;nbsp; 60&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q&amp;nbsp;&amp;nbsp; w&amp;nbsp;&amp;nbsp; r&amp;nbsp;&amp;nbsp;&amp;nbsp; t&amp;nbsp;&amp;nbsp; y&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need all the variable of first.ID wit Prefix=ABC wit sum of (ABC+ABN+ABP) and delete the&amp;nbsp; ABN and ABP record&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Feb 2015 19:53:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178333#M45548</guid>
      <dc:creator>avinashns</dc:creator>
      <dc:date>2015-02-23T19:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add &amp; Delete the Duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178334#M45549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your directions aren't very clear to me. Looks like you simply want to recode some values and then summarize the data to the pol_id level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that is what you are trying to do, then here is one way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data need;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; pol_id=tranwrd(pol_id,'AZN','AZC');&lt;/P&gt;&lt;P&gt;&amp;nbsp; pol_id=tranwrd(pol_id,'AZP','AZC');&lt;/P&gt;&lt;P&gt;&amp;nbsp; pol_id=tranwrd(pol_id,'ABN','ABC');&lt;/P&gt;&lt;P&gt;&amp;nbsp; pol_id=tranwrd(pol_id,'ABP','ABC');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc summary data=need nway;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var amount;&lt;/P&gt;&lt;P&gt;&amp;nbsp; class pol_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output out=want (drop=_:) sum=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Feb 2015 20:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178334#M45549</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-23T20:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Add &amp; Delete the Duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178335#M45550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Avinash wrote me off line, but I still don't know if I understand what he is trying to accomplish. The following is my best guess for now:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Given the following data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat pol_id $6.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat amount comma8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input POL_ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amount;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;AZN123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $25&lt;/P&gt;&lt;P&gt;ABN456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $44&lt;/P&gt;&lt;P&gt;AZP123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $50&lt;/P&gt;&lt;P&gt;ABC456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $20&lt;/P&gt;&lt;P&gt;CRG020&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $60&lt;/P&gt;&lt;P&gt;AZC123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $15&lt;/P&gt;&lt;P&gt;ABP456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $10&lt;/P&gt;&lt;P&gt;NYP020&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $50&lt;/P&gt;&lt;P&gt;HRG090&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $10&lt;/P&gt;&lt;P&gt;AZN999&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $25&lt;/P&gt;&lt;P&gt;LLL999&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $30&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*collapse by pol_id*/&lt;/P&gt;&lt;P&gt;proc summary data=have nway;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var amount;&lt;/P&gt;&lt;P&gt;&amp;nbsp; class pol_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output out=need (drop=_:)sum=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*extract _id and _prefix*/&lt;/P&gt;&lt;P&gt;data need;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set need;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _prefix=substr(pol_id,1,3);&lt;/P&gt;&lt;P&gt;&amp;nbsp; _id=substr(pol_id,4);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*sort by _id and _prefix*/&lt;/P&gt;&lt;P&gt;proc sort data=need;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by _id _prefix;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*change certain pol_ids if first record begins with AZC or ABC*/&lt;/P&gt;&lt;P&gt;data need;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set need;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by _id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain _changeit;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first._id then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _prefix in ('AZC','ABC') then _changeit=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else _changeit=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if _changeit then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pol_id=tranwrd(pol_id,'AZN','AZC');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pol_id=tranwrd(pol_id,'AZP','AZC');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pol_id=tranwrd(pol_id,'ABN','ABC');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pol_id=tranwrd(pol_id,'ABP','ABC');&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Collapse the modified data*/&lt;/P&gt;&lt;P&gt;proc summary data=need nway;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var amount;&lt;/P&gt;&lt;P&gt;&amp;nbsp; class pol_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output out=want (drop=_:)sum=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Feb 2015 22:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178335#M45550</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-23T22:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add &amp; Delete the Duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178336#M45551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BangON,&lt;/P&gt;&lt;P&gt;The second part with _id and _prefix is the exact solution i was looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you once again. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 11:31:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178336#M45551</guid>
      <dc:creator>avinashns</dc:creator>
      <dc:date>2015-02-24T11:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Add &amp; Delete the Duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178337#M45552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Team,&lt;/P&gt;&lt;P&gt;As per &lt;STRONG style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="1088" data-externalid="" data-presence="null" data-userid="149594" data-username="art297" href="https://communities.sas.com/people/art297" id="jive-14959440342240294444186" style="padding: 0 3px 0 0; font-weight: inherit; font-style: inherit; font-size: 1.1em; font-family: inherit; color: #0e66ba;"&gt;Arthur&lt;/A&gt;&lt;/STRONG&gt;'s solutions the below code will fetch what i want&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;/*Collapse the modified data*/&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;proc summary data=need nway;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp; var amount;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp; class pol_id;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp; output out=want (drop=_:)sum=;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;run;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;But the output contains only pol_id and amount variable,&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;I would like to have all the variable &lt;/P&gt;&lt;P class="jive-thread-reply-btn" style="margin: 26px 0 -10px; font-size: 0.9em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;DIV class="jive-thread-reply-btn-correct" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/thread/71507" style="margin: 0 20px 0 0; padding: 2px 14px 4px 28px; font-weight: bold; font-style: inherit; font-family: inherit; color: #0e66ba; background-color: #f3f3f3;"&gt;Add &amp;amp; Delete the Duplicate records&lt;/A&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 15:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Add-Delete-the-Duplicate-records/m-p/178337#M45552</guid>
      <dc:creator>avinashns</dc:creator>
      <dc:date>2015-02-26T15:18:00Z</dc:date>
    </item>
  </channel>
</rss>

