<?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: Age variable char vs numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Age-variable-char-vs-numeric/m-p/196506#M36902</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you're using the third parameter to YRDIF, it should be character.&amp;nbsp; Try putting "age" in quotes inside the function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Jul 2015 16:45:40 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2015-07-06T16:45:40Z</dc:date>
    <item>
      <title>Age variable char vs numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Age-variable-char-vs-numeric/m-p/196505#M36901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a dataset in which I've created an age variable using a date of birth variable and an "age as of" variable (which I created as well), like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Calculate age from DOB*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want_age;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;ageasof='01NOV2012'D;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA create_age;&lt;/P&gt;&lt;P&gt;set want_age;&lt;/P&gt;&lt;P&gt;age=floor(yrdif(datepart(dob), ageasof, age));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code runs fine and seems to calculate age correctly; however, I get a message after the second step saying that Numeric values have been converted to character values. I want age to be a numeric variable, so this is problematic. However, when I run a proc contents, it says age is already numeric, and when I go to the next step which uses values of age to create age categories, I treat age as numeric and it works fine. I'm confused about why I'm getting the message re: age being converted to character values when that doesn't actually seem to be the case. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jul 2015 15:50:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Age-variable-char-vs-numeric/m-p/196505#M36901</guid>
      <dc:creator>Walternate</dc:creator>
      <dc:date>2015-07-06T15:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Age variable char vs numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Age-variable-char-vs-numeric/m-p/196506#M36902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you're using the third parameter to YRDIF, it should be character.&amp;nbsp; Try putting "age" in quotes inside the function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jul 2015 16:45:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Age-variable-char-vs-numeric/m-p/196506#M36902</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-07-06T16:45:40Z</dc:date>
    </item>
  </channel>
</rss>

