<?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: better ways to display age in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/better-ways-to-display-age/m-p/367623#M87564</link>
    <description>&lt;P&gt;Try the INTCK function. This will adjust properly for issues like leap years, differing number of days in months for example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;years = intck('dtyear', DOB, SchoolEntry, 'C');&lt;BR /&gt;&lt;BR /&gt;months = intck('dtmonth', DOB, SchoolEntry, 'C');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check out the documentation here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#p1md4mx2crzfaqn14va8kt7qvfhr.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#p1md4mx2crzfaqn14va8kt7qvfhr.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2017 07:59:38 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2017-06-16T07:59:38Z</dc:date>
    <item>
      <title>better ways to display age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/better-ways-to-display-age/m-p/367608#M87555</link>
      <description>&lt;P&gt;I am looking for a solution to elegantly display age.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say I have two datetime varoiables: DOB and a variable called&amp;nbsp;School Entry, at which age were the children schooled ?&lt;/P&gt;&lt;P&gt;Time_in_Seconds = (School Entry - DOB) - what is the best way to convert this into age including years,&amp;nbsp;months and days?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="lia-linear-display-message-view"&gt;&lt;DIV&gt;&lt;DIV class="lia-message-view message-uid-367606"&gt;&lt;DIV&gt;&lt;DIV class="lia-js-resize-images lia-component-forums-widget-board-message-view"&gt;&lt;DIV&gt;&lt;DIV class="lia-message-board lia-panel-message lia-js-data-messageUid-367606"&gt;&lt;DIV class="lia-panel-message-content"&gt;&lt;DIV class="lia-decoration-border"&gt;&lt;DIV class="lia-decoration-border-content"&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class="lia-quilt lia-quilt-forum-message lia-quilt-layout-forum-message"&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-forum-message-main"&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-right lia-quilt-column-main-right"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-right"&gt;&lt;DIV class="lia-message-body lia-component-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;Often it is just displayed in years, but I would want a more exact approach, therefore something like : Tane is&amp;nbsp;12 years, 5 months and 4 days old.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could create someting over multiple colums, whereby&lt;/P&gt;&lt;P&gt;age_min&amp;nbsp; =ROUND ((age_sec)/60);&lt;BR /&gt;age_h&amp;nbsp;&amp;nbsp;&amp;nbsp; =ROUND&amp;nbsp; ((age_sec)/3600);&lt;BR /&gt;age_d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =ROUND ((age_sec)/86400);&lt;BR /&gt;age_y&amp;nbsp;&amp;nbsp; =ROUND ((age_sec)/31536000);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but that is not very elegant. Would&amp;nbsp;anybody know a better way to deal with this?&lt;/P&gt;&lt;P&gt;many thanks&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Jun 2017 04:53:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/better-ways-to-display-age/m-p/367608#M87555</guid>
      <dc:creator>AnnaNZ</dc:creator>
      <dc:date>2017-06-16T04:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: better ways to display age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/better-ways-to-display-age/m-p/367623#M87564</link>
      <description>&lt;P&gt;Try the INTCK function. This will adjust properly for issues like leap years, differing number of days in months for example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;years = intck('dtyear', DOB, SchoolEntry, 'C');&lt;BR /&gt;&lt;BR /&gt;months = intck('dtmonth', DOB, SchoolEntry, 'C');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check out the documentation here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#p1md4mx2crzfaqn14va8kt7qvfhr.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#p1md4mx2crzfaqn14va8kt7qvfhr.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 07:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/better-ways-to-display-age/m-p/367623#M87564</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-06-16T07:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: better ways to display age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/better-ways-to-display-age/m-p/367684#M87587</link>
      <description>&lt;P&gt;Asuming DIF is the difference in seconds then you may try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;age = put(datepart(DIF),yymmdd10.);&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 11:50:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/better-ways-to-display-age/m-p/367684#M87587</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-06-16T11:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: better ways to display age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/better-ways-to-display-age/m-p/367694#M87589</link>
      <description>&lt;P&gt;Find below a sample program that calculates the age in years months and days.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The sample is based on a SAS date value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ageCalc;
  infile cards dlm=",";
  input
    min_date : date9.
    max_date : date9.
  ;
  years    = intck('year',min_date,max_date,'c');
  months   = intck('month',intnx('year',min_date,years,'same'),max_date,'c');
  days     = intck('day',intnx('month',intnx('year',min_date,years,'same'),months,'same'),max_date,'c');
  format min_date max_date ddmmyyp10.;
cards;
10NOV1963,26sep2013
15mar1961,11oct2001
31jan2000,01mar2000
29feb2000,28feb2001
;

proc print data=ageCalc;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jun 2017 12:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/better-ways-to-display-age/m-p/367694#M87589</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-06-16T12:44:40Z</dc:date>
    </item>
  </channel>
</rss>

