<?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: Exclude patients from a file, based on patid defined in another file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exclude-patients-from-a-file-based-on-patid-defined-in-another/m-p/808502#M318817</link>
    <description>Too simple, thank you very much! &lt;BR /&gt;</description>
    <pubDate>Tue, 19 Apr 2022 08:56:53 GMT</pubDate>
    <dc:creator>jspoend</dc:creator>
    <dc:date>2022-04-19T08:56:53Z</dc:date>
    <item>
      <title>Exclude patients from a file, based on patid defined in another file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exclude-patients-from-a-file-based-on-patid-defined-in-another/m-p/808497#M318815</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have 2 datafiles.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Claims_file&lt;/STRONG&gt;: all claims during pregnancy of women insured with a certain insurer&lt;/P&gt;
&lt;P&gt;pregID date_claim ATC&lt;/P&gt;
&lt;P&gt;1 mmddyy xy&lt;/P&gt;
&lt;P&gt;1 mmddyy xy&lt;/P&gt;
&lt;P&gt;1 mmddyy xy&lt;/P&gt;
&lt;P&gt;2&amp;nbsp;mmddyy xy&lt;/P&gt;
&lt;P&gt;2&amp;nbsp;mmddyy xy&lt;/P&gt;
&lt;P&gt;3&amp;nbsp;mmddyy xy&lt;/P&gt;
&lt;P&gt;3&amp;nbsp;mmddyy xy&lt;/P&gt;
&lt;P&gt;3&amp;nbsp;mmddyy xy&lt;/P&gt;
&lt;P&gt;4&amp;nbsp;mmddyy xy&lt;/P&gt;
&lt;P&gt;4&amp;nbsp;mmddyy xy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;abortions_file&lt;/STRONG&gt;: IDs of pregnancies which had an abortion shortly before the start of pregnancy&lt;/P&gt;
&lt;P&gt;PregID date_abort&lt;/P&gt;
&lt;P&gt;1 mmddyy&lt;/P&gt;
&lt;P&gt;3 mmddyy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I need to do is to exclude all pregnancies (so all claims from any pregnancy) from the claims_file, which are listed in the abortion_file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure how to go about this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I usually run this code to ONLY include patients defined in another file, but I'm not sure how to change it, in order to EXCLUDE patients defined in another file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data claims_no abort;&lt;BR /&gt;set claims_file;&lt;BR /&gt;if _n_ = 1&lt;BR /&gt;then do;&lt;BR /&gt;declare hash a (dataset:"abortions_file");&lt;BR /&gt;a.definekey("pregID");&lt;BR /&gt;a.definedone();&lt;BR /&gt;end;&lt;BR /&gt;if a.check() = 0;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks in advance, Julia&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 08:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exclude-patients-from-a-file-based-on-patid-defined-in-another/m-p/808497#M318815</guid>
      <dc:creator>jspoend</dc:creator>
      <dc:date>2022-04-19T08:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude patients from a file, based on patid defined in another file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exclude-patients-from-a-file-based-on-patid-defined-in-another/m-p/808500#M318816</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/318953"&gt;@jspoend&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just insert a "not" (symbol: ~) into the subsetting IF condition:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;if a.check() &lt;FONT color="#FF00FF"&gt;&lt;STRONG&gt;~&lt;/STRONG&gt;&lt;/FONT&gt;= 0;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;(You can also use the mnemonic &lt;FONT face="courier new,courier"&gt;ne&lt;/FONT&gt; instead of &lt;FONT face="courier new,courier"&gt;~=&lt;/FONT&gt;.) Nonzero return codes from the CHECK method mean that the key value (here: the &lt;FONT face="courier new,courier"&gt;pregID&lt;/FONT&gt; value) was not found in the hash object (here: in the&amp;nbsp;&lt;SPAN&gt;abortions_file). Missing return codes cannot occur anyway, so you can even &lt;/SPAN&gt;simplify the condition to&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;if a.check();&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;This is equivalent to the requirement that the return code is neither zero &lt;EM&gt;nor missing&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 08:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exclude-patients-from-a-file-based-on-patid-defined-in-another/m-p/808500#M318816</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-04-19T08:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude patients from a file, based on patid defined in another file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exclude-patients-from-a-file-based-on-patid-defined-in-another/m-p/808502#M318817</link>
      <description>Too simple, thank you very much! &lt;BR /&gt;</description>
      <pubDate>Tue, 19 Apr 2022 08:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exclude-patients-from-a-file-based-on-patid-defined-in-another/m-p/808502#M318817</guid>
      <dc:creator>jspoend</dc:creator>
      <dc:date>2022-04-19T08:56:53Z</dc:date>
    </item>
  </channel>
</rss>

