<?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: Active patients based admission and discharge date in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Active-patients-based-admission-and-discharge-date/m-p/842257#M82198</link>
    <description>&lt;P&gt;Calculate start and end values:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data long;
set have;
start = year(admission);
if month(admission) lt 7 then start = start - 1;
end = coalesce(discharge,today());
if month(end) lt 7
then end = year(end) - 1;
else end = year(end);
do year = start to end;
  output;
end;
keep patient_id year;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Nov 2022 07:48:19 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-11-03T07:48:19Z</dc:date>
    <item>
      <title>Active patients based admission and discharge date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Active-patients-based-admission-and-discharge-date/m-p/842042#M82195</link>
      <description>I currently have data on patients with admission dates and discharge dates, and I want to extract the number of active patients every year. The data contain patients that haven’t been discharged yet, so the discharge date is blank.&lt;BR /&gt;&lt;BR /&gt;For example, 200 patients were active in 2020 and 400 patients in 2122.</description>
      <pubDate>Wed, 02 Nov 2022 09:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Active-patients-based-admission-and-discharge-date/m-p/842042#M82195</guid>
      <dc:creator>Sofia2022</dc:creator>
      <dc:date>2022-11-02T09:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Active patients based admission and discharge date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Active-patients-based-admission-and-discharge-date/m-p/842045#M82196</link>
      <description>&lt;P&gt;Oh, a time traveler!&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;For example, 200 patients were active in 2020 and 400 patients in 2&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;22.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Joking aside, what about this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data long;
set have;
do year = year(admission) to year(coalesce(discharge,today());
  output;
end;
keep patient_id year;
run;

/* next step is necessary if you want to count patients instead of stays */
proc sort data=long nodupkey;
by patient_id year;
run;

proc freq data=long;
tables year;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 09:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Active-patients-based-admission-and-discharge-date/m-p/842045#M82196</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-02T09:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Active patients based admission and discharge date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Active-patients-based-admission-and-discharge-date/m-p/842253#M82197</link>
      <description>Great Kurt. It’s working :). How about if I want to report the output by financial year (July to June) ?? For example, there were 200 active below between July 2020 and June 2021, 600 between July 2021 and June 2022.</description>
      <pubDate>Thu, 03 Nov 2022 03:23:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Active-patients-based-admission-and-discharge-date/m-p/842253#M82197</guid>
      <dc:creator>Sofia2022</dc:creator>
      <dc:date>2022-11-03T03:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Active patients based admission and discharge date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Active-patients-based-admission-and-discharge-date/m-p/842257#M82198</link>
      <description>&lt;P&gt;Calculate start and end values:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data long;
set have;
start = year(admission);
if month(admission) lt 7 then start = start - 1;
end = coalesce(discharge,today());
if month(end) lt 7
then end = year(end) - 1;
else end = year(end);
do year = start to end;
  output;
end;
keep patient_id year;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2022 07:48:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Active-patients-based-admission-and-discharge-date/m-p/842257#M82198</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-03T07:48:19Z</dc:date>
    </item>
  </channel>
</rss>

