<?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 Delete observations only if they meet two conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-only-if-they-meet-two-conditions/m-p/843813#M333586</link>
    <description>&lt;P&gt;Can someone help me out with some code that would delete observations where date="31Oct2022"d AND prev_date="31Mar2022"d (i.e. observation only deleted if BOTH conditions are true)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired outcome: Delete observations only where date="31Oct2022"d &lt;U&gt;AND&lt;/U&gt; prev_date="31Mar2022"d i.e. if only one condition met, &lt;U&gt;keep observations&lt;/U&gt; e.g. date="29Apr2022"d / prev_date="31Mar2022"d because only one condition is met&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Justin9_0-1668181519635.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77214iB01620D0BF9964A6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Justin9_0-1668181519635.png" alt="Justin9_0-1668181519635.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run the code below, it&amp;nbsp; deletes observations&amp;nbsp;where date="31Oct2022"d or prev_date="31Mar2022"d for some reason (e.g. in my example above, it deleted the three observations where&amp;nbsp;date="29Apr2022"d / prev_date="31Mar2022"d)&amp;nbsp; - can someone suggest how I can edit my code to get my desired outcome please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
       set ac.information_values;
       where (date ne "31Oct2022"d and prev_date ne "31Mar2022"d);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 11 Nov 2022 15:59:41 GMT</pubDate>
    <dc:creator>Justin9</dc:creator>
    <dc:date>2022-11-11T15:59:41Z</dc:date>
    <item>
      <title>Delete observations only if they meet two conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-only-if-they-meet-two-conditions/m-p/843813#M333586</link>
      <description>&lt;P&gt;Can someone help me out with some code that would delete observations where date="31Oct2022"d AND prev_date="31Mar2022"d (i.e. observation only deleted if BOTH conditions are true)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired outcome: Delete observations only where date="31Oct2022"d &lt;U&gt;AND&lt;/U&gt; prev_date="31Mar2022"d i.e. if only one condition met, &lt;U&gt;keep observations&lt;/U&gt; e.g. date="29Apr2022"d / prev_date="31Mar2022"d because only one condition is met&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Justin9_0-1668181519635.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77214iB01620D0BF9964A6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Justin9_0-1668181519635.png" alt="Justin9_0-1668181519635.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run the code below, it&amp;nbsp; deletes observations&amp;nbsp;where date="31Oct2022"d or prev_date="31Mar2022"d for some reason (e.g. in my example above, it deleted the three observations where&amp;nbsp;date="29Apr2022"d / prev_date="31Mar2022"d)&amp;nbsp; - can someone suggest how I can edit my code to get my desired outcome please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
       set ac.information_values;
       where (date ne "31Oct2022"d and prev_date ne "31Mar2022"d);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Nov 2022 15:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-only-if-they-meet-two-conditions/m-p/843813#M333586</guid>
      <dc:creator>Justin9</dc:creator>
      <dc:date>2022-11-11T15:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations only if they meet two conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-only-if-they-meet-two-conditions/m-p/843817#M333588</link>
      <description>&lt;P&gt;Obvi a problem where the words of explanation don't match the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your run the code shown and then "When I run the code below, it deletes observations where date="31Oct2022"d or prev_date="31Mar2022"d for some reason", I consider this impossible, either that's not the code, or your words are wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you could clear that up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, what I *think* you want is this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
       set ac.information_values;
       if date="31Oct2022"d and prev_date="31Mar2022"d then delete;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 16:25:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-only-if-they-meet-two-conditions/m-p/843817#M333588</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-11T16:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations only if they meet two conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-only-if-they-meet-two-conditions/m-p/843818#M333589</link>
      <description>Apologies, my code was supposed to be ne rather than =. Thanks for the code and help!</description>
      <pubDate>Fri, 11 Nov 2022 16:01:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-only-if-they-meet-two-conditions/m-p/843818#M333589</guid>
      <dc:creator>Justin9</dc:creator>
      <dc:date>2022-11-11T16:01:33Z</dc:date>
    </item>
  </channel>
</rss>

