<?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: How to count days between multiple admissions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-days-between-multiple-admissions/m-p/619665#M181996</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You are not really clear about your variables and the structure of the data but I would guess you have some kind of admission date. Try using LAG function per subject and then calculate the difference of days between the 2 dates (the normal one and the newly created lag one).</description>
    <pubDate>Thu, 23 Jan 2020 20:45:33 GMT</pubDate>
    <dc:creator>geoskiad</dc:creator>
    <dc:date>2020-01-23T20:45:33Z</dc:date>
    <item>
      <title>How to count days between multiple admissions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-days-between-multiple-admissions/m-p/619659#M181992</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have hospital admissions data for a cohort of children.&amp;nbsp; Some children have only one admission, while others have many.&amp;nbsp; Each admission is a new row.&amp;nbsp; So I can have multiple rows for each child, and each row is a new hospital admission.&lt;/P&gt;&lt;P&gt;I want to count the days between each admission for each child.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS9.4 1M5&lt;/P&gt;&lt;P&gt;Many thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 20:15:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-days-between-multiple-admissions/m-p/619659#M181992</guid>
      <dc:creator>drshashlik</dc:creator>
      <dc:date>2020-01-23T20:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to count days between multiple admissions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-days-between-multiple-admissions/m-p/619665#M181996</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You are not really clear about your variables and the structure of the data but I would guess you have some kind of admission date. Try using LAG function per subject and then calculate the difference of days between the 2 dates (the normal one and the newly created lag one).</description>
      <pubDate>Thu, 23 Jan 2020 20:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-days-between-multiple-admissions/m-p/619665#M181996</guid>
      <dc:creator>geoskiad</dc:creator>
      <dc:date>2020-01-23T20:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to count days between multiple admissions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-days-between-multiple-admissions/m-p/619666#M181997</link>
      <description>&lt;P&gt;A very important question: is the admission date a SAS date valued variable, meaning numeric with a format like DATE9. or MMDDYY10. or similar applied to it?&lt;/P&gt;
&lt;P&gt;If not then we need to know exactly how your date values are stored as that seriously affects the next steps.&lt;/P&gt;
&lt;P&gt;And is the value actually a date or does it have a time component as well? Some folks seem not to know the difference and we get questions about "dates" like 01JAN2020:17:23:15, which has TIME and different approach would be needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the date variable is a SAS date value then something like:&lt;/P&gt;
&lt;PRE&gt;Proc sort data=have;
   by childid date;
run;

data want; 
   set have;
   by childid;
   days= dif(date);
   if first.childid then days = 0;
run;&lt;/PRE&gt;
&lt;P&gt;Days will have the number days between visits for those children&amp;nbsp;with multiple visits and with 0 for the first visit by any child.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 20:46:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-days-between-multiple-admissions/m-p/619666#M181997</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-01-23T20:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to count days between multiple admissions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-days-between-multiple-admissions/m-p/619668#M181999</link>
      <description>&lt;P&gt;thanks Ballardw,&lt;/P&gt;&lt;P&gt;date is&amp;nbsp;DDMMYY10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 20:48:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-days-between-multiple-admissions/m-p/619668#M181999</guid>
      <dc:creator>drshashlik</dc:creator>
      <dc:date>2020-01-23T20:48:23Z</dc:date>
    </item>
  </channel>
</rss>

