<?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: date of birth and age in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256185#M49047</link>
    <description>&lt;P&gt;The first subject won't be 22 years old until 12/22/16 but the program results in an age of 22 now even though the subject is only 21.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The yrdif function can be used to correctly calculate age in years in 9.3 and 9.4 but that won't work for months or weeks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One can read about&amp;nbsp;&lt;SPAN&gt;Billy Kreuter's classic solution to the age calcualtion problem here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://www.pauldickman.com/teaching/sas/age.php" target="_blank"&gt;http://www.pauldickman.com/teaching/sas/age.php&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://staff.washington.edu/billyk/TechTips_SC4Q98.pdf" target="_blank"&gt;http://staff.washington.edu/billyk/TechTips_SC4Q98.pdf&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Billy's code can be modified to get age in months or&amp;nbsp;weeks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Paul&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Mar 2016 18:14:46 GMT</pubDate>
    <dc:creator>Paul_OldenKamp_org</dc:creator>
    <dc:date>2016-03-11T18:14:46Z</dc:date>
    <item>
      <title>date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/255991#M48993</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to get age out of the date of birth (DOB) as given below.&amp;nbsp; I have following questions/points:&lt;/P&gt;&lt;P&gt;1. How can I get today's date in SAS dataset?&lt;/P&gt;&lt;P&gt;2. How can I get age in years, weeks and days?&lt;/P&gt;&lt;P&gt;3. How can I round off if it comes in decimals?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DOB&lt;/TD&gt;&lt;TD&gt;age&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12/22/1994&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12/5/1990&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12/21/1978&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12/27/1977&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/28/1980&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4/26/1987&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6/5/1977&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10/8/1980&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3/23/1990&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/3/1991&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;06/01/198&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/26/1982&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5/17/1990&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10/28/1985&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/8/1981&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5/26/1995&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 11 Mar 2016 03:21:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/255991#M48993</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-03-11T03:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/255996#M48997</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use below code for your requirement.&lt;/P&gt;&lt;P&gt;INTCK() function will not give values in decimals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;input dob mmddyy10.;&lt;BR /&gt;format dob mmddyy10.;&lt;BR /&gt;cards;&lt;BR /&gt;12/22/1994&lt;BR /&gt;12/05/1990&lt;BR /&gt;12/21/1978&lt;BR /&gt;12/27/1977&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test1;&lt;BR /&gt;set test;&lt;BR /&gt;format date mmddyy10.;&lt;BR /&gt;date=today(); /*Get today's date*/&lt;BR /&gt;agey=intck('year',dob,date); /*Get age in years*/&lt;BR /&gt;agem=intck('month',dob,date); /*Get age in months*/&lt;BR /&gt;agew=intck('week',dob,date); /*Get age in weeks*/&lt;BR /&gt;aged=intck('days',dob,date); /*Get age in days*/&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 05:20:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/255996#M48997</guid>
      <dc:creator>amadhavi41</dc:creator>
      <dc:date>2016-03-11T05:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/255997#M48998</link>
      <description>&lt;P&gt;we have today() to get today date, the belwo code give the age in years&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input DOB: mmddyy10.;
age=yrdif(dob,today(),'age');
format dob date9.;
cards;
12/22/1994	 
12/5/1990	 
12/21/1978	 
12/27/1977	 
11/28/1980	 
4/26/1987	 
6/5/1977	 
10/8/1980	 
3/23/1990	 
8/3/1991	 
06/01/1988	 
8/26/1982	 
5/17/1990	 
10/28/1985	 
8/8/1981	 
5/26/1995
;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Mar 2016 05:23:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/255997#M48998</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2016-03-11T05:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/255998#M48999</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data are already entered and it is a dataset with around a thousand rows.&amp;nbsp; Is there any way I do not have to enter the rahter I could get the required outcome by using the codes.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 05:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/255998#M48999</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-03-11T05:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/255999#M49000</link>
      <description>&lt;P&gt;Use set statement for your created dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data test1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set test;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format date mmddyy10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;date=today(); /*Get today's date*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;agey=intck('year',dob,date); /*Get age in years*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;agem=intck('month',dob,date); /*Get age in months*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;agew=intck('week',dob,date); /*Get age in weeks*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;aged=intck('days',dob,date); /*Get age in days*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 05:40:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/255999#M49000</guid>
      <dc:creator>amadhavi41</dc:creator>
      <dc:date>2016-03-11T05:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256000#M49001</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp; My response is similar to what I wrote to Jag; I have already entered data, how can I get my required output by writing codes instead of entering data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, INTCK() will not give decimals but I have seen that even the value is 0.9758 it would give 0 years; is that not wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 05:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256000#M49001</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-03-11T05:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256001#M49002</link>
      <description>&lt;P&gt;Many thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My date is already in this format (&lt;SPAN&gt;mmddyy10&lt;/SPAN&gt;), still I need to keep this code?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 05:43:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256001#M49002</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-03-11T05:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256002#M49003</link>
      <description>&lt;P&gt;No need to use format in your program just use the given function statements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 05:49:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256002#M49003</guid>
      <dc:creator>amadhavi41</dc:creator>
      <dc:date>2016-03-11T05:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256006#M49004</link>
      <description>&lt;P&gt;I ran the code and it gives todays date and also creats columns for all categories for age but it does not calculate the age and cells/data are blank or missing.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 05:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256006#M49004</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-03-11T05:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256007#M49005</link>
      <description>&lt;P&gt;If you have any decimal values use round(age) or rounde(age) to get integer values.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 05:58:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256007#M49005</guid>
      <dc:creator>amadhavi41</dc:creator>
      <dc:date>2016-03-11T05:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256008#M49006</link>
      <description>&lt;P&gt;please share your program&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 06:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256008#M49006</guid>
      <dc:creator>amadhavi41</dc:creator>
      <dc:date>2016-03-11T06:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256010#M49007</link>
      <description>&lt;BR /&gt;dob&lt;BR /&gt;date&lt;BR /&gt;agey&lt;BR /&gt;agem&lt;BR /&gt;agew&lt;BR /&gt;aged&lt;BR /&gt;1 12/22/1994 03/11/2016 22 255 1107 7750&lt;BR /&gt;2 12/05/1990 03/11/2016 26 303 1318 9228&lt;BR /&gt;3 12/21/1978 03/11/2016 38 447 1942 13595&lt;BR /&gt;4 12/27/1977 03/11/2016 39 459 1993 13954&lt;BR /&gt;&lt;BR /&gt;I just checked in SAS the above result you will get.</description>
      <pubDate>Fri, 11 Mar 2016 06:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256010#M49007</guid>
      <dc:creator>amadhavi41</dc:creator>
      <dc:date>2016-03-11T06:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256011#M49008</link>
      <description>obs dob date agey agem agew aged&lt;BR /&gt;&lt;BR /&gt;1 12/22/1994 03/11/2016 22 255 1107 7750&lt;BR /&gt;2 12/05/1990 03/11/2016 26 303 1318 9228&lt;BR /&gt;3 12/21/1978 03/11/2016 38 447 1942 13595&lt;BR /&gt;4 12/27/1977 03/11/2016 39 459 1993 13954&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Mar 2016 06:09:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256011#M49008</guid>
      <dc:creator>amadhavi41</dc:creator>
      <dc:date>2016-03-11T06:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: date of birth and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256185#M49047</link>
      <description>&lt;P&gt;The first subject won't be 22 years old until 12/22/16 but the program results in an age of 22 now even though the subject is only 21.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The yrdif function can be used to correctly calculate age in years in 9.3 and 9.4 but that won't work for months or weeks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One can read about&amp;nbsp;&lt;SPAN&gt;Billy Kreuter's classic solution to the age calcualtion problem here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://www.pauldickman.com/teaching/sas/age.php" target="_blank"&gt;http://www.pauldickman.com/teaching/sas/age.php&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://staff.washington.edu/billyk/TechTips_SC4Q98.pdf" target="_blank"&gt;http://staff.washington.edu/billyk/TechTips_SC4Q98.pdf&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Billy's code can be modified to get age in months or&amp;nbsp;weeks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Paul&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 18:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-of-birth-and-age/m-p/256185#M49047</guid>
      <dc:creator>Paul_OldenKamp_org</dc:creator>
      <dc:date>2016-03-11T18:14:46Z</dc:date>
    </item>
  </channel>
</rss>

