<?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 from two dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800370#M314825</link>
    <description>&lt;P&gt;The NOTEs about conversion from character to numeric indicate that you do not have date values (numeric, count of days starting at 1960-01-01), but strings that look like dates. You need to correct that when the dataset(s) that lead up to this are created.&lt;/P&gt;</description>
    <pubDate>Sat, 05 Mar 2022 20:05:38 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-03-05T20:05:38Z</dc:date>
    <item>
      <title>Calculate age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800334#M314801</link>
      <description>&lt;P&gt;Kindly see the below code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data PKMERGE;
set PKDAR;
/*Derivation of age*/
age=intck('year',VSN1D, DOB1D, 'Continuous'); /*Check the age*/
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The below log appears&lt;/P&gt;&lt;PRE&gt;NOTE: Invalid numeric data, ATLSMP1T='10:58' , at line 117
      column 15.
NOTE: Invalid numeric data, SMP1D='20MAR2006' , at line 117
      column 30&lt;/PRE&gt;&lt;P&gt;The image of data&lt;/P&gt;&lt;DIV class=""&gt;&lt;BR /&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;SPAN class=""&gt;Updating Media&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 13:32:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800334#M314801</guid>
      <dc:creator>Tejaswini3</dc:creator>
      <dc:date>2022-03-05T13:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800338#M314805</link>
      <description>&lt;P&gt;The code you posted does not use any of the variables mentioned in the messages.&lt;/P&gt;
&lt;P&gt;Please post the&amp;nbsp;&lt;EM&gt;complete&lt;/EM&gt; log of the &lt;EM&gt;actual&lt;/EM&gt; step that caused the NOTEs you posted.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 14:01:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800338#M314805</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-05T14:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800347#M314811</link>
      <description>&lt;P&gt;Kindly see the log below in image.. Not able to type as text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tejaswini3_0-1646493164101.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69174i54412630D81B4D3F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tejaswini3_0-1646493164101.png" alt="Tejaswini3_0-1646493164101.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 15:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800347#M314811</guid>
      <dc:creator>Tejaswini3</dc:creator>
      <dc:date>2022-03-05T15:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800356#M314817</link>
      <description>&lt;P&gt;As the log clearly points out&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ATLSMP1T='10:58'&lt;/PRE&gt;
&lt;P&gt;in not a valid numeric value. Do you understand why?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However if you put a letter T after it, then it becomes a valid SAS time value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ATLSMP1T='10:58't&lt;/PRE&gt;
&lt;P&gt;However, looking at your code, you need to fix this in data set PKDAR, as we don't know how that was created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future, please present your LOG as text and not as a screen capture. In the future, please include the text of your LOG in the window that appears when you click on the &amp;lt;/&amp;gt; icon&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66123iA4EF494F9CA0F6EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 16:27:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800356#M314817</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-05T16:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800365#M314823</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416543"&gt;@Tejaswini3&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Looks like the format of the date variables DOBID and VSNID are not properly defined.&lt;BR /&gt;This can be clearly seen from the screen shot of the log you have posted. Once this is corrected, you should be able to calculate the age. Have a look at the example below and it should help.&lt;BR /&gt;Initially the variables DOB and VSD are character type. They are converted to date format and used.&lt;/P&gt;
&lt;PRE&gt;data test (keep =name DOBID VSNID age);&lt;BR /&gt;length name $  20  DOB VSD $9;&lt;BR /&gt;format DOBID VSNID date9.; &lt;BR /&gt;input name $ DOB $ VSD;&lt;BR /&gt;DOBID=input(DOB,date9.);&lt;BR /&gt;VSNID=input(VSD,date9.);&lt;BR /&gt;age=intck('year',DOBID, VSNID,  'Continuous');&lt;BR /&gt;dataline;&lt;BR /&gt;SOME_NAME 18JUL1955 18APR2006&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;The output would be as follows&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_0-1646508476608.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69177i5F3F82FF0DA1B7CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_0-1646508476608.png" alt="Sajid01_0-1646508476608.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Make appropriate changes to suit your situation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Your question was on age calculation. I have focused on that. Other errors if any need to be appropriately addressed.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 19:31:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800365#M314823</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-03-05T19:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800370#M314825</link>
      <description>&lt;P&gt;The NOTEs about conversion from character to numeric indicate that you do not have date values (numeric, count of days starting at 1960-01-01), but strings that look like dates. You need to correct that when the dataset(s) that lead up to this are created.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 20:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800370#M314825</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-05T20:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate age from two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800444#M314880</link>
      <description>&lt;P&gt;Following log is seen&lt;/P&gt;&lt;PRE&gt;NOTE: Character values have been converted to numeric
      values at the places given by: (Line):(Column).
      266:18   266:25
NOTE: Invalid numeric data, VSN1D='18APR2006' , at line 266
      column 18.
NOTE: Invalid numeric data, DOB1D='08JUL1955' , at line 266
      column 25.&lt;/PRE&gt;&lt;P&gt;Kindly help in how to resolve&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 08:49:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-age-from-two-dates/m-p/800444#M314880</guid>
      <dc:creator>Tejaswini3</dc:creator>
      <dc:date>2022-03-06T08:49:34Z</dc:date>
    </item>
  </channel>
</rss>

