<?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: Identify patients across several lines based on lack of a specific value in any line in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796822#M255724</link>
    <description>&lt;P&gt;Or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table want as
   select * from have
   group by PatID
   having sum(location = 'home')
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 17 Feb 2022 09:35:24 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2022-02-17T09:35:24Z</dc:date>
    <item>
      <title>Identify patients across several lines based on lack of a specific value in any line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796818#M255720</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with a dataset of midwive billing codes. The dataset has one line per midwive visit, so several lines per patient.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The datafile is structured as follows:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PatID VisitID location purpose&lt;/P&gt;&lt;P&gt;1 1 hospital postpartum&lt;/P&gt;&lt;P&gt;1 2 home postpartum&lt;/P&gt;&lt;P&gt;1 3 home postpartum&lt;/P&gt;&lt;P&gt;2 1 home&amp;nbsp; postpartum&lt;/P&gt;&lt;P&gt;2 2 home postpartum&lt;/P&gt;&lt;P&gt;3 1 hospital postpartum&lt;/P&gt;&lt;P&gt;4 1 home&amp;nbsp; postpartum&lt;/P&gt;&lt;P&gt;4 2 home postpartum&lt;/P&gt;&lt;P&gt;4 3 home postpartum&lt;/P&gt;&lt;P&gt;4 4 home postpartum&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to identify and exclude those patients, who exclusively had visits at location 'hospital' and none at home. So some code checking if they had any visit at home and if not they would be flagged. If they had a first visit at hospital with subsequent visits at home they stay in. i.e. patient 3 would have to be excluded.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure how to best go about this, so any inputs are appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance, Julia&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 09:06:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796818#M255720</guid>
      <dc:creator>jspoend</dc:creator>
      <dc:date>2022-02-17T09:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Identify patients across several lines based on lack of a specific value in any line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796820#M255722</link>
      <description>&lt;P&gt;How about&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input PatID VisitID location $ purpose :$10.;
datalines;
1 1 hospital postpartum
1 2 home     postpartum
1 3 home     postpartum
2 1 home     postpartum
2 2 home     postpartum
3 1 hospital postpartum
4 1 home     postpartum
4 2 home     postpartum
4 3 home     postpartum
4 4 home     postpartum
;

data want;
   if _N_ = 1 then do;
      dcl hash h(dataset : "have(where = (location = 'home'))");
      h.definekey('PatID');
      h.definedone();
   end;
   
   set have;
   
   if h.check() = 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Feb 2022 09:29:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796820#M255722</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-02-17T09:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Identify patients across several lines based on lack of a specific value in any line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796822#M255724</link>
      <description>&lt;P&gt;Or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table want as
   select * from have
   group by PatID
   having sum(location = 'home')
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Feb 2022 09:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796822#M255724</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-02-17T09:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Identify patients across several lines based on lack of a specific value in any line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796827#M255726</link>
      <description>&lt;P&gt;Dear Peter,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both of your answers seem to work perfectly, thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Julia&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 10:08:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796827#M255726</guid>
      <dc:creator>jspoend</dc:creator>
      <dc:date>2022-02-17T10:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Identify patients across several lines based on lack of a specific value in any line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796836#M255730</link>
      <description>&lt;P&gt;Anytime &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 11:11:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-patients-across-several-lines-based-on-lack-of-a/m-p/796836#M255730</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-02-17T11:11:07Z</dc:date>
    </item>
  </channel>
</rss>

