<?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 Reg:Dates Diff in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reg-Dates-Diff/m-p/32239#M6232</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;actually i am having a joining date i want to find how many years he was wroking to till date&lt;/P&gt;&lt;P&gt;data l;&lt;BR /&gt;sdate='12jan2010'd;&lt;BR /&gt;enddate=today()&lt;BR /&gt;Tot=yrdif(sdate, edate, 'ACT/365');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;But i wnat the output like this how many years,months and days to till date.&lt;/P&gt;&lt;P&gt;sdate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Years&amp;nbsp; Months days&lt;BR /&gt;12jan2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Mar 2012 07:22:14 GMT</pubDate>
    <dc:creator>My_SAS</dc:creator>
    <dc:date>2012-03-15T07:22:14Z</dc:date>
    <item>
      <title>Reg:Dates Diff</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reg-Dates-Diff/m-p/32239#M6232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;actually i am having a joining date i want to find how many years he was wroking to till date&lt;/P&gt;&lt;P&gt;data l;&lt;BR /&gt;sdate='12jan2010'd;&lt;BR /&gt;enddate=today()&lt;BR /&gt;Tot=yrdif(sdate, edate, 'ACT/365');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;But i wnat the output like this how many years,months and days to till date.&lt;/P&gt;&lt;P&gt;sdate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Years&amp;nbsp; Months days&lt;BR /&gt;12jan2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 07:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reg-Dates-Diff/m-p/32239#M6232</guid>
      <dc:creator>My_SAS</dc:creator>
      <dc:date>2012-03-15T07:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reg:Dates Diff</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reg-Dates-Diff/m-p/32240#M6233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a link to a useful article on the SAS website on how to calculate age from date of birth. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/24/808.html"&gt;http://support.sas.com/kb/24/808.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've used this technique to answer your question, first of all I've calculated the total number of complete months between the 2 dates and then used this to get the values you need (years is the integer part of total_months/12, months is the remainder of total_months/12, days is the difference between the end date and the start date advanced by total_months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; l;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; sdate enddate &lt;/SPAN&gt;&lt;SPAN style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;sdate=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;'12jan2010'd&lt;/STRONG&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;enddate=today();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;_totmonths=intck(&lt;/SPAN&gt;&lt;SPAN style="color: purple; font-family: 'Courier New'; font-size: 10pt;"&gt;'month'&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;,sdate,enddate)-(day(enddate)&amp;lt; day(sdate));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;years=floor(_totmonths/&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;months=mod(_totmonths,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;days=enddate-intnx(&lt;/SPAN&gt;&lt;SPAN style="color: purple; font-family: 'Courier New'; font-size: 10pt;"&gt;'month'&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;,sdate,_totmonths,&lt;/SPAN&gt;&lt;SPAN style="color: purple; font-family: 'Courier New'; font-size: 10pt;"&gt;'S'&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; _totmonths;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 11:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reg-Dates-Diff/m-p/32240#M6233</guid>
      <dc:creator>Keith</dc:creator>
      <dc:date>2012-03-15T11:50:44Z</dc:date>
    </item>
  </channel>
</rss>

