<?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: Remove duplicated dates based on an Index value in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/933202#M41949</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I just edited the post with all possible cases. Thank you very much!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;While that works in this case, in general we want data and the proper output (which you have provided), but also an explanation in words so we don't have to take our time to figure out what is happening and possibly getting it wrong. You already know, please share what you know with us. Please in the future, tell us what the logic is to go from input data to output data.&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jun 2024 17:02:20 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-06-20T17:02:20Z</dc:date>
    <item>
      <title>Remove duplicated dates based on an Index value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/932945#M41942</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose to have the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DB;
input ID :$20. Admission :date09. Discharge :date09. Index1;
format Admission date9. Discharge date9.;
cards;
0001 13JAN2017 25JAN2017 0 
0001 22FEB2018 03MAR2018 0 
0001 30JAN2019 04MAR2019 0 
0001 30JAN2019 04MAR2019 1 
0001 25DEC2020 02JAN2021 0 
0002 15JAN2014 29JAN2014 1 
0002 01FEB2015 10FEB2015 0 
0002 01FEB2015 10FEB2015 0 
0003 22MAR2019 23MAR2019 1 
0003 22MAR2019 23MAR2019 0
0003 02JUL2019 28AUG2019 0
0004 01SEP2022 15SEP2022 1
0004 02DEC2023 05DEC2023 1
;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to get the following? In other words I need to remove duplicated rows (identical admission-discharge date) and retain the inly one where Index1 = 1. I tried with proc sort to order by the date and the Index1 (descending) without success. Thank you in advance!&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;data DB1;
input ID :$20. Admission :date09. Discharge :date09. Index1;
format Admission date9. Discharge date9.;
cards;
0001 13JAN2017 25JAN2017 0 
0001 22FEB2018 03MAR2018 0 
0001 30JAN2019 04MAR2019 1 
0001 25DEC2020 02JAN2021 0 
0002 15JAN2014 29JAN2014 1 
0002 01FEB2015 10FEB2015 0 
0003 22MAR2019 23MAR2019 1   
0003 02JUL2019 28AUG2019 0              
0004 01SEP2022 15SEP2022 1            
0004 02DEC2023 05DEC2023 1
;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 12:30:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/932945#M41942</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-06-19T12:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicated dates based on an Index value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/932955#M41943</link>
      <description>&lt;P&gt;May we assume there is exactly one record which has index=1 for duplicated rows? Is this record with index=1 always the second record of the duplicated records? Are there ever triplicates or quadruplicates?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 09:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/932955#M41943</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-06-19T09:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicated dates based on an Index value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/932976#M41945</link>
      <description>I just edited the post with all possible cases. Thank you very much!</description>
      <pubDate>Wed, 19 Jun 2024 12:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/932976#M41945</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-06-19T12:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicated dates based on an Index value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/933194#M41948</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=db;
by id admission discharge index1;
run;

data db1;
set db;
by id admission discharge;
if last.discharge.
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jun 2024 15:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/933194#M41948</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-06-20T15:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicated dates based on an Index value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/933202#M41949</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I just edited the post with all possible cases. Thank you very much!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;While that works in this case, in general we want data and the proper output (which you have provided), but also an explanation in words so we don't have to take our time to figure out what is happening and possibly getting it wrong. You already know, please share what you know with us. Please in the future, tell us what the logic is to go from input data to output data.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 17:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-duplicated-dates-based-on-an-Index-value/m-p/933202#M41949</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-06-20T17:02:20Z</dc:date>
    </item>
  </channel>
</rss>

