<?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: Conditionally deleting repeated observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-deleting-repeated-observations/m-p/768785#M243876</link>
    <description>&lt;P&gt;Can you provide us with some example data so that we can test out code? Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Sep 2021 13:56:55 GMT</pubDate>
    <dc:creator>maguiremq</dc:creator>
    <dc:date>2021-09-21T13:56:55Z</dc:date>
    <item>
      <title>Conditionally deleting repeated observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-deleting-repeated-observations/m-p/768773#M243870</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a somewhat complex conditional delete that I am trying to figure out, and it is based on repeated observations, and I have three different types of repeaters that need to be pruned. Essentially, I have a dataset with people who have been interviewed at 2 times.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I want to delete observations for all of these repeaters so that they only have one visit in the dataset, and I would like to do this conditionally on two variables (ACECAT, which is ACEs category, and INT_D, which is interview date). There are three types of repeaters that I need to remove one visit from. They can be identified as repeaters via the use of another variable, site_ID (though in this dataset I've actually restricted so that only repeaters are present).&lt;BR /&gt;&lt;BR /&gt;The&lt;STRONG&gt; first type&lt;/STRONG&gt; of repeater is missing ACECAT at BOTH visits - for these, it doesn't really matter which observation gets deleted, but for the sake of consistency I would like to delete the first observation and keep the last. INT_D is formatted in DDMMMYYYY format.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;the &lt;STRONG&gt;second type&lt;/STRONG&gt; of repeater has answered ACECAT at one visit and is missing ACECAT in the other visit - for these types of repeaters, I want to drop the observation where ACECAT is missing.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;the &lt;STRONG&gt;third type&lt;/STRONG&gt; of repeater has answered ACECAT at both visits. For these types of repeaters, I want to keep only the most recent observation and drop the last observation.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I've been trying to think of a data step (or multiple data steps if needed) that can solve this problem, but am drawing a blank. Can anyone help?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 13:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-deleting-repeated-observations/m-p/768773#M243870</guid>
      <dc:creator>zfusfeld</dc:creator>
      <dc:date>2021-09-21T13:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally deleting repeated observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-deleting-repeated-observations/m-p/768785#M243876</link>
      <description>&lt;P&gt;Can you provide us with some example data so that we can test out code? Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 13:56:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-deleting-repeated-observations/m-p/768785#M243876</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-09-21T13:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally deleting repeated observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-deleting-repeated-observations/m-p/768973#M243924</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/312547"&gt;@zfusfeld&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;BR /&gt;the &lt;STRONG&gt;third type&lt;/STRONG&gt; of repeater has answered ACECAT at both visits. For these types of repeaters, I want to keep only the most recent observation and drop the last observation.&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If your data are sorted by INT_D within each id/group, then isn't the most recent observation (to be kept) the same as the last observation (to be dropped)?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 23:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-deleting-repeated-observations/m-p/768973#M243924</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-09-21T23:34:08Z</dc:date>
    </item>
  </channel>
</rss>

