<?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: Calculate AGE using BIRTH and DEATH DATE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473870#M121662</link>
    <description>Yes, thats correct</description>
    <pubDate>Wed, 27 Jun 2018 18:45:33 GMT</pubDate>
    <dc:creator>Nasya</dc:creator>
    <dc:date>2018-06-27T18:45:33Z</dc:date>
    <item>
      <title>Calculate AGE using BIRTH and DEATH DATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473862#M121656</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When trying to calculate the age using death and birth dates, leaves output as 50.7677488 etc. However, displaying&amp;nbsp; values like this 51 is expected instead of 50.7677488.&lt;/P&gt;&lt;PRE&gt;data data1_;
	attrib BRTHDAT_ DTHDAT_  length=8 format=date9.;
	attrib AGE_D length=3;
	set data1;

if BRTHDAT ne . then
	BRTHDAT_=datepart(BRTHDAT);

if DTHDAT ne . then
	DTHDAT_=datepart(DTHDAT);

if DTHDAT_ ne . and BRTHDAT_ ne . then do;
	AGE_D=(DTHDAT_ - BRTHDAT_)/365.25;
end;

proc sort data=data1_;
	by SUBJECT;
run;&lt;/PRE&gt;&lt;P&gt;Attached is the code.&lt;/P&gt;&lt;P&gt;Any correction that has to be made to display the age right?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nasya&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 18:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473862#M121656</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-06-27T18:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate AGE using BIRTH and DEATH DATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473864#M121657</link>
      <description>&lt;P&gt;can ceil function help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if DTHDAT_ ne . and BRTHDAT_ ne . then do;
	AGE_D=ceil((DTHDAT_ - BRTHDAT_)/365.25);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or using yrdif and ceil&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; &amp;nbsp; age=ceil(yrdif(brthdat_, dthdat_, 'AGE'));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 18:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473864#M121657</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-06-27T18:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate AGE using BIRTH and DEATH DATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473866#M121659</link>
      <description>&lt;P&gt;I imagine you are looking for the age to be rounded:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;if DTHDAT_ ne . and BRTHDAT_ ne . then do;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt; AGE_D= round((DTHDAT_ - BRTHDAT_)/365.25);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, leave the calculations as they are, but change the attributes of AGE_D:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;attrib AGE_D length=8 format=3.;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 18:47:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473866#M121659</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-27T18:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate AGE using BIRTH and DEATH DATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473870#M121662</link>
      <description>Yes, thats correct</description>
      <pubDate>Wed, 27 Jun 2018 18:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473870#M121662</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-06-27T18:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate AGE using BIRTH and DEATH DATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473871#M121663</link>
      <description>using yrdif and ceil worked..&lt;BR /&gt;Thank you,&lt;BR /&gt;&lt;BR /&gt;NASYA</description>
      <pubDate>Wed, 27 Jun 2018 18:47:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473871#M121663</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-06-27T18:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate AGE using BIRTH and DEATH DATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473874#M121664</link>
      <description>Worked. Thank you.</description>
      <pubDate>Wed, 27 Jun 2018 18:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-AGE-using-BIRTH-and-DEATH-DATE/m-p/473874#M121664</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-06-27T18:50:18Z</dc:date>
    </item>
  </channel>
</rss>

