<?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: Delete a matched control if the corresponding matched case is deleted in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401154#M97289</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="UserName lia-user-name lia-user-rank-Valued-Guide"&gt;&lt;SPAN&gt;&amp;nbsp;mkeintz&lt;/SPAN&gt;&lt;SPAN class="login-bold"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Valued-Guide"&gt;&lt;SPAN class="login-bold"&gt;You exactly provided the solution to my query.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Valued-Guide"&gt;&lt;SPAN class="login-bold"&gt;Thank you very much for your support.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Oct 2017 20:26:42 GMT</pubDate>
    <dc:creator>arzon</dc:creator>
    <dc:date>2017-10-04T20:26:42Z</dc:date>
    <item>
      <title>Delete a matched control if the corresponding matched case is deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401053#M97249</link>
      <description>&lt;P&gt;Hi Dears,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would greatly appreciate your help to delete some matched observations from a dataset. Briefly, I have a dataset in which cases are matched with controls and then a variable (exclusion_variable) is used to exclude ID that met the criterion of exclusion. As presented in the table below, I would like to delete the corresponding controls as the case (ID=1x) is to be excluded.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp; &amp;nbsp;matching_ID &amp;nbsp; case &amp;nbsp; exclusion_variable&lt;/P&gt;&lt;P&gt;1x &amp;nbsp; &amp;nbsp; aa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;2x &amp;nbsp; &amp;nbsp; aa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;3x &amp;nbsp; &amp;nbsp; aa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very match for your valuable help!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 16:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401053#M97249</guid>
      <dc:creator>arzon</dc:creator>
      <dc:date>2017-10-04T16:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a matched control if the corresponding matched case is deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401068#M97250</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/169528"&gt;@arzon&lt;/a&gt;&amp;nbsp;welcome to the SAS forums.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately your question is unclear. Can you please clarify what you have and what you want as output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/169528"&gt;@arzon&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Dears,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would greatly appreciate your help to delete some matched observations from a dataset. Briefly, I have a dataset in which cases are matched with controls and then a variable (exclusion_variable) is used to exclude ID that met the criterion of exclusion. As presented in the table below, I would like to delete the corresponding controls as the case (ID=1x) is to be excluded.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID &amp;nbsp; &amp;nbsp;matching_ID &amp;nbsp; case &amp;nbsp; exclusion_variable&lt;/P&gt;
&lt;P&gt;1x &amp;nbsp; &amp;nbsp; aa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;2x &amp;nbsp; &amp;nbsp; aa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;3x &amp;nbsp; &amp;nbsp; aa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very match for your valuable help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 17:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401068#M97250</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-04T17:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a matched control if the corresponding matched case is deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401098#M97262</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;Thanks for your reply and sorry for being unclear (I am not fully fluent in English and that may explain why)&lt;/P&gt;&lt;P&gt;To clarify, lets consider the 'exclusion_variable' as 'death' and that the ID=1x &amp;nbsp;is dead (case=1) and is to be excluded from the dataset (if death=1 then delete). As the ID 2x, and &amp;nbsp;3x are matched to the ID 1x (i.e. same matching_ID) I would like to delete these ID from the dataset to preserve the matching nature of the overall dataset. &amp;nbsp;So, How can I can suppress these matched ID?&lt;/P&gt;&lt;P&gt;Hope this clarifies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 18:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401098#M97262</guid>
      <dc:creator>arzon</dc:creator>
      <dc:date>2017-10-04T18:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a matched control if the corresponding matched case is deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401099#M97263</link>
      <description>&lt;P&gt;So based on your sample data what do you expect as output?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 18:08:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401099#M97263</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-04T18:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a matched control if the corresponding matched case is deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401104#M97266</link>
      <description>&lt;P&gt;ID &amp;nbsp; &amp;nbsp;matching_ID &amp;nbsp; case &amp;nbsp; exclusion_variable&lt;/P&gt;&lt;P&gt;1x &amp;nbsp; &amp;nbsp; aa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;2x &amp;nbsp; &amp;nbsp; aa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;3x &amp;nbsp; &amp;nbsp; aa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;4x &amp;nbsp; &amp;nbsp; bb &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;5x &amp;nbsp; &amp;nbsp; bb &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;6x &amp;nbsp; &amp;nbsp; bb &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the above table, my output will be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp; &amp;nbsp;matching_ID &amp;nbsp; case &amp;nbsp; exclusion_variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4x &amp;nbsp; &amp;nbsp; bb &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;5x &amp;nbsp; &amp;nbsp; bb &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;6x &amp;nbsp; &amp;nbsp; bb &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 18:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401104#M97266</guid>
      <dc:creator>arzon</dc:creator>
      <dc:date>2017-10-04T18:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a matched control if the corresponding matched case is deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401107#M97269</link>
      <description>&lt;P&gt;Why do your refer BOTH to variable CASE and variable EXCLUSION_VAR?&amp;nbsp; Do you just mean to filter out all matching_id's for which any record has an EXCLUSION_VAR=1?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edited addition:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, then this will do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input id :$2. matching_id :$2. case exclusion_variable;
datalines;
1x     aa                  1         1
2x     aa                  0         0
3x     aa                  0         0
4X     bb                  0         0
run;

data want (drop=rc);
  set have;
  if _n_=1 then do;
    declare hash exclude_id (dataset:'have (keep=matching_id exclusion_variable where=(exclusion_variable=1))');
    exclude_id.definekey('matching_id');
    exclude_id.definedone();
  end;
  rc=exclude_id.check();
  if rc^=0;
run;
        &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 18:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401107#M97269</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-10-04T18:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a matched control if the corresponding matched case is deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401154#M97289</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="UserName lia-user-name lia-user-rank-Valued-Guide"&gt;&lt;SPAN&gt;&amp;nbsp;mkeintz&lt;/SPAN&gt;&lt;SPAN class="login-bold"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Valued-Guide"&gt;&lt;SPAN class="login-bold"&gt;You exactly provided the solution to my query.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Valued-Guide"&gt;&lt;SPAN class="login-bold"&gt;Thank you very much for your support.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 20:26:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-matched-control-if-the-corresponding-matched-case-is/m-p/401154#M97289</guid>
      <dc:creator>arzon</dc:creator>
      <dc:date>2017-10-04T20:26:42Z</dc:date>
    </item>
  </channel>
</rss>

