<?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 Deleteing observation with equal variable as one with certain conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594036#M170602</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I could not find a solution for this problem on the board so I thought I would ask instead.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;As the long subject line says,&lt;/P&gt;&lt;P&gt;If a variable A meets certain conditions then I want to delete all observations with the same variable B as the other observation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If A&amp;nbsp; &amp;gt;10 and B is 5, then I want to remove all variables where B=5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I want this&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Obs A B&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;1 5 10&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;2 11 10&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;3 1 11&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;4 9 11&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;5 12 12&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;6 3 13&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To become this&lt;/P&gt;&lt;P&gt;1 1 11&lt;/P&gt;&lt;P&gt;2 9 11&lt;/P&gt;&lt;P&gt;3 3 13&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Oct 2019 07:10:51 GMT</pubDate>
    <dc:creator>Viktoreli</dc:creator>
    <dc:date>2019-10-04T07:10:51Z</dc:date>
    <item>
      <title>Deleteing observation with equal variable as one with certain conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594036#M170602</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I could not find a solution for this problem on the board so I thought I would ask instead.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;As the long subject line says,&lt;/P&gt;&lt;P&gt;If a variable A meets certain conditions then I want to delete all observations with the same variable B as the other observation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If A&amp;nbsp; &amp;gt;10 and B is 5, then I want to remove all variables where B=5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I want this&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Obs A B&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;1 5 10&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;2 11 10&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;3 1 11&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;4 9 11&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;5 12 12&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;6 3 13&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To become this&lt;/P&gt;&lt;P&gt;1 1 11&lt;/P&gt;&lt;P&gt;2 9 11&lt;/P&gt;&lt;P&gt;3 3 13&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 07:10:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594036#M170602</guid>
      <dc:creator>Viktoreli</dc:creator>
      <dc:date>2019-10-04T07:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Deleteing observation with equal variable as one with certain conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594037#M170603</link>
      <description>&lt;P&gt;I don't see one obs where B=5?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 07:19:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594037#M170603</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-04T07:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Deleteing observation with equal variable as one with certain conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594040#M170604</link>
      <description>Should have added that in my lines,&lt;BR /&gt;b=5 was just an example of a value.&lt;BR /&gt;I was not clear enough in what I was asking.&lt;BR /&gt;&lt;BR /&gt;If an observation meets certain conditions in variable A,&lt;BR /&gt;I want to remove all observations with the same variable B as the observation that met the conditions for variable A.</description>
      <pubDate>Fri, 04 Oct 2019 07:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594040#M170604</guid>
      <dc:creator>Viktoreli</dc:creator>
      <dc:date>2019-10-04T07:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Deleteing observation with equal variable as one with certain conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594041#M170605</link>
      <description>&lt;P&gt;Here you go:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input a b;
  datalines;
5 10
11 10
1 11
9 11
12 12
3 13
;

data want;
  if _n_=1 then
    do;
      dcl hash h1(dataset:'have(where=(a&amp;gt;10))');
      h1.defineKey('b');
      h1.defineDone();
    end;
  set have;
  if h1.check()=0 then delete;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Oct 2019 07:51:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594041#M170605</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-04T07:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Deleteing observation with equal variable as one with certain conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594045#M170606</link>
      <description>&lt;P&gt;Ok. I would go with the solution by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp; then.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively you could do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input a b;
  datalines;
5 10
11 10
1 11
9 11
12 12
3 13
;

data want;
    array _ {1000000} _temporary_;
    do until (lr1);
        set have(where=(a&amp;gt;10)) end=lr1;
        _[b]=1;
    end;

    do until (lr2);
        set have end=lr2;
        if _[b] ne 1 then output;
    end;
    stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Oct 2019 08:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594045#M170606</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-04T08:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Deleteing observation with equal variable as one with certain conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594050#M170607</link>
      <description>Worked great and yielded the same result as patricks!&lt;BR /&gt;Im very grateful!</description>
      <pubDate>Fri, 04 Oct 2019 08:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594050#M170607</guid>
      <dc:creator>Viktoreli</dc:creator>
      <dc:date>2019-10-04T08:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Deleteing observation with equal variable as one with certain conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594051#M170608</link>
      <description>Thanks alot!</description>
      <pubDate>Fri, 04 Oct 2019 08:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleteing-observation-with-equal-variable-as-one-with-certain/m-p/594051#M170608</guid>
      <dc:creator>Viktoreli</dc:creator>
      <dc:date>2019-10-04T08:48:58Z</dc:date>
    </item>
  </channel>
</rss>

