<?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 rows on several conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-on-several-conditions/m-p/783240#M249697</link>
    <description>Perfect!!! Thanks so much!!! Highly appreciated!!!</description>
    <pubDate>Tue, 30 Nov 2021 18:29:22 GMT</pubDate>
    <dc:creator>Barkat</dc:creator>
    <dc:date>2021-11-30T18:29:22Z</dc:date>
    <item>
      <title>Deleting rows on several conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-on-several-conditions/m-p/783225#M249692</link>
      <description>&lt;P&gt;I have a hypothetical data as below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If&amp;nbsp; data in the 1st, 2nd, 3rd, 5th and 6th column are same and 4th column is either "A" or "B" then they will be considered as duplicate and one of those rows will be kept.&lt;/P&gt;
&lt;P&gt;also&lt;/P&gt;
&lt;P&gt;If&amp;nbsp; data in the 1st, 2nd, 3rd, 5th and 6th column are same and 4th column is either "D" or "E" then they will be considered as duplicate and one of those rows will be kept.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, the following rows will be considered as duplicates and one of them will be kept.&lt;/P&gt;
&lt;P&gt;Rows 1 and 2&lt;/P&gt;
&lt;P&gt;Rows 4 and 5&lt;/P&gt;
&lt;P&gt;Rows 6 and 7&lt;/P&gt;
&lt;P&gt;Rows 9 and 10&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input ID date Test $ SubTest $ SourceCode Result $;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1/1/21 ABC A 1 Positive&lt;BR /&gt;1 1/1/21 ABC B 1 Positive&lt;BR /&gt;1 1/1/21 ABC C 1 Negative&lt;BR /&gt;1 1/10/21 DEF D 1 Positive&lt;BR /&gt;1 1/10/21 DEF E 1 Positive&lt;BR /&gt;1 1/10/21 DEF F 1 Negative&lt;/P&gt;
&lt;P&gt;2 1/1/21 ABC A 1 Negative&lt;BR /&gt;2 1/1/21 ABC B 1 Negative&lt;BR /&gt;2 1/1/21 ABC C 1 Negative&lt;BR /&gt;2 1/10/21 DEF D 1 Positive&lt;BR /&gt;2 1/10/21 DEF E 1 Positive&lt;BR /&gt;2 1/10/21 DEF F 1 Negative&lt;/P&gt;
&lt;P&gt;3 1/1/21 ABC A 1 Positive&lt;BR /&gt;3 1/1/21 ABC B 1 Negative&lt;BR /&gt;3 1/1/21 ABC C 1 Negative&lt;BR /&gt;3 1/10/21 DEF D 1 Negative&lt;BR /&gt;3 1/10/21 DEF E 1 Positive&lt;BR /&gt;3 1/10/21 DEF F 1 Negative&lt;/P&gt;
&lt;P&gt;4 1/1/21 ABC A 1 Positive&lt;BR /&gt;4 1/1/21 ABC B 2 Positive&lt;BR /&gt;4 1/1/21 ABC C 1 Negative&lt;BR /&gt;4 1/10/21 DEF D 1 Negative&lt;BR /&gt;4 1/10/21 DEF E 1 Positive&lt;BR /&gt;4 1/10/21 DEF F 1 Negative&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 17:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-on-several-conditions/m-p/783225#M249692</guid>
      <dc:creator>Barkat</dc:creator>
      <dc:date>2021-11-30T17:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows on several conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-on-several-conditions/m-p/783233#M249693</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    prev_id=lag(id);
    prev_date=lag(date);
    prev_test=lag(test);
    prev_subtest=lag(subtest);
    prev_sourcecode=lag(sourcecode);
    prev_result=lag(result);
    if prev_id=id and prev_date=date and prev_test=test 
        and prev_sourcecode=sourcecode and prev_result=result then do;
        if prev_subtest='A' and subtest='B' then delete;
        if prev_subtest='D' and subtest='E' then delete;
        if prev_subtest=subtest then delete;
    end;
    drop prev_:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Nov 2021 18:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-on-several-conditions/m-p/783233#M249693</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-30T18:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows on several conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-on-several-conditions/m-p/783240#M249697</link>
      <description>Perfect!!! Thanks so much!!! Highly appreciated!!!</description>
      <pubDate>Tue, 30 Nov 2021 18:29:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-on-several-conditions/m-p/783240#M249697</guid>
      <dc:creator>Barkat</dc:creator>
      <dc:date>2021-11-30T18:29:22Z</dc:date>
    </item>
  </channel>
</rss>

