<?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 compute  age from two dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278508#M56028</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hi , &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need to &amp;nbsp;calculate age at graduation. &amp;nbsp;I&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;was wondering if &amp;nbsp;any of &amp;nbsp;the&amp;nbsp;&lt;SPAN class="lia-search-match-lithium"&gt;two&lt;/SPAN&gt;&amp;nbsp;methods below&amp;nbsp;are appropriate and take care &amp;nbsp;&lt;STRONG&gt;leap years&lt;/STRONG&gt; as well.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Method 1:&amp;nbsp;&lt;SPAN class="lia-search-match-lithium"&gt;Age&lt;/SPAN&gt;=&amp;nbsp;&lt;SPAN&gt;INTCK('year',dob,graduationdate,"C")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Method&amp;nbsp;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="lia-search-match-lithium"&gt;Age&lt;/SPAN&gt;&lt;SPAN&gt;= (&lt;/SPAN&gt;graduationdate-dob)/365.25&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Jun 2016 18:35:34 GMT</pubDate>
    <dc:creator>archibald</dc:creator>
    <dc:date>2016-06-19T18:35:34Z</dc:date>
    <item>
      <title>compute  age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278508#M56028</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hi , &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need to &amp;nbsp;calculate age at graduation. &amp;nbsp;I&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;was wondering if &amp;nbsp;any of &amp;nbsp;the&amp;nbsp;&lt;SPAN class="lia-search-match-lithium"&gt;two&lt;/SPAN&gt;&amp;nbsp;methods below&amp;nbsp;are appropriate and take care &amp;nbsp;&lt;STRONG&gt;leap years&lt;/STRONG&gt; as well.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Method 1:&amp;nbsp;&lt;SPAN class="lia-search-match-lithium"&gt;Age&lt;/SPAN&gt;=&amp;nbsp;&lt;SPAN&gt;INTCK('year',dob,graduationdate,"C")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Method&amp;nbsp;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="lia-search-match-lithium"&gt;Age&lt;/SPAN&gt;&lt;SPAN&gt;= (&lt;/SPAN&gt;graduationdate-dob)/365.25&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jun 2016 18:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278508#M56028</guid>
      <dc:creator>archibald</dc:creator>
      <dc:date>2016-06-19T18:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: compute  age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278510#M56029</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The recommended formula:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;age = intck('year',dob,event) - (put(dob,mmddyy4.) &amp;gt; put(event,mmddyy4.)) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-in-Health-Care-Related/Calculating-Age-But-Not-Rounding-Up/td-p/100367" target="_blank"&gt;https://communities.sas.com/t5/SAS-in-Health-Care-Related/Calculating-Age-But-Not-Rounding-Up/td-p/100367&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jun 2016 18:41:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278510#M56029</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-19T18:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: compute  age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278535#M56041</link>
      <description>&lt;P&gt;Isn't it a bit strange that one would have to resort to datestring formatting to calculate an age? The matter depends on a specific case: if you are born on the 29th of February (in a leap year, obviously), do you celebrate your birthday on the 28th of February or on the first of March, during non-leap years? If your answer is the former then your age is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;intck("year", dob, event, "continuous") &amp;nbsp;/* birthday on the 28th during non-leap years */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;otherwise, your age is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;intck('year', dob, event) - (put(dob, mmddyy4.) &amp;gt; put(event, mmddyy4.)) &amp;nbsp;/* birthday on March 1st &lt;SPAN&gt;during non-leap years&amp;nbsp;&lt;/SPAN&gt;*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another option is to use function INT(YRDIF(dob, event, "AGE")). It considers that you will celebrate your birthday on the 28th, even on leap years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jun 2016 21:40:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278535#M56041</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-19T21:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: compute  age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278548#M56044</link>
      <description>&lt;P&gt;This makes a lot sense.Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jun 2016 22:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278548#M56044</guid>
      <dc:creator>archibald</dc:creator>
      <dc:date>2016-06-19T22:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: compute  age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278549#M56045</link>
      <description>&lt;P&gt;Great! Thank you very much&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jun 2016 22:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278549#M56045</guid>
      <dc:creator>archibald</dc:creator>
      <dc:date>2016-06-19T22:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: compute  age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278550#M56046</link>
      <description>Great! Thank you very much Reeza</description>
      <pubDate>Sun, 19 Jun 2016 22:34:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compute-age-from-two-dates/m-p/278550#M56046</guid>
      <dc:creator>archibald</dc:creator>
      <dc:date>2016-06-19T22:34:48Z</dc:date>
    </item>
  </channel>
</rss>

