<?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: Difference in days between two dates in two different rows and different columns in All Things Community</title>
    <link>https://communities.sas.com/t5/All-Things-Community/Difference-in-days-between-two-dates-in-two-different-rows-and/m-p/324350#M2152</link>
    <description>&lt;P&gt;It's not necessarily simple, but it doesn't take a lot of code.&amp;nbsp; Assuming your dates are SAS dates, not character strings:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;set have (firstobs=2 keep=date1 rename=(date1=next_date)) have (drop=_all_);&lt;/P&gt;
&lt;P&gt;if last.id=0 then diff = next_date - date2;&lt;/P&gt;
&lt;P&gt;drop next_date;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jan 2017 17:38:38 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-01-12T17:38:38Z</dc:date>
    <item>
      <title>Difference in days between two dates in two different rows and different columns</title>
      <link>https://communities.sas.com/t5/All-Things-Community/Difference-in-days-between-two-dates-in-two-different-rows-and/m-p/324341#M2151</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to compute the difference in days between two dates that are located in two different rows and in different columns by id. For example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; diff&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;1 &amp;nbsp; &amp;nbsp;&amp;nbsp; 03/01/1991 &amp;nbsp;&amp;nbsp;&amp;nbsp; 08/31/1992 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09/01/1992 - 08/31/1992 &amp;nbsp;&amp;nbsp; (or 08/31/1992 - 09/01/1992)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09/01/1992 &amp;nbsp;&amp;nbsp;&amp;nbsp; 07/31/1992 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 08/01/1996 - 07/31/1992&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 08/01/1996&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 06/30/1997&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 07/01/1997 - 06/30/1997&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 07/01/1997&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 07/31/1997&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09/01/1993&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01/15/1994&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01/01/1994 &amp;nbsp;&amp;nbsp;&amp;nbsp; 01/01/1995&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01/01/1995 - 01/01/1995&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01/01/1995 &amp;nbsp; &amp;nbsp; 05/02/1999 &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will appreciate your help. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 17:11:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/All-Things-Community/Difference-in-days-between-two-dates-in-two-different-rows-and/m-p/324341#M2151</guid>
      <dc:creator>miguelito</dc:creator>
      <dc:date>2017-01-12T17:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Difference in days between two dates in two different rows and different columns</title>
      <link>https://communities.sas.com/t5/All-Things-Community/Difference-in-days-between-two-dates-in-two-different-rows-and/m-p/324350#M2152</link>
      <description>&lt;P&gt;It's not necessarily simple, but it doesn't take a lot of code.&amp;nbsp; Assuming your dates are SAS dates, not character strings:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;set have (firstobs=2 keep=date1 rename=(date1=next_date)) have (drop=_all_);&lt;/P&gt;
&lt;P&gt;if last.id=0 then diff = next_date - date2;&lt;/P&gt;
&lt;P&gt;drop next_date;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 17:38:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/All-Things-Community/Difference-in-days-between-two-dates-in-two-different-rows-and/m-p/324350#M2152</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-12T17:38:38Z</dc:date>
    </item>
  </channel>
</rss>

