<?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 Trouble with SAS dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Trouble-with-SAS-dates/m-p/350527#M81483</link>
    <description>&lt;P&gt;I apologize if this has been answered - I could not find the post I did Friday.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a function I have used for years successfully to calculate age. It's&lt;BR /&gt;&lt;BR /&gt; ((floor ((intck('month',&lt;BR /&gt;&lt;BR /&gt; T1.DATEOFBIRTH,&lt;BR /&gt;&lt;BR /&gt; T1.DATEBEGIN_AT_CLO) - (day (T1.DATEBEGIN_AT_CLO) &amp;lt; day (T1.DATEOFBIRTH)))/12) )&lt;BR /&gt; )&lt;BR /&gt;&lt;BR /&gt; Where I want to calculate age at datebegin_At_Clo .The problem here is that I am starting with a date stored as a text field (I did not generate it the federal government does and I do not know how they formatted it except that it is a string).&lt;BR /&gt;&lt;BR /&gt; It is of the form '19761026' where the first four digits are the year, the next two the month and the next two the days. &lt;BR /&gt;&lt;BR /&gt; I ran &lt;BR /&gt;&lt;BR /&gt; PROC SQL;&lt;BR /&gt; CREATE TABLE WORK.QUERY_FOR_Q16 AS &lt;BR /&gt; SELECT t1.DateOfBirth, &lt;BR /&gt; t1.ClosureDate, &lt;BR /&gt; /* DOB */&lt;BR /&gt; (INPUT(t1.DateOfBirth, yyyymmdd10.)) LABEL="DOB" AS DOB, &lt;BR /&gt; /* CD */&lt;BR /&gt; (INPUT(t1.ClosureDate, yyyymmdd10.)) LABEL="CD" AS CD&lt;BR /&gt; FROM WORK.Q16 t1;&lt;BR /&gt; QUIT;&lt;BR /&gt;&lt;BR /&gt; and it appears to generate a number fine. However when I use the new fields (DOB and CD) in the age function above I get no results (not errors just no results).&lt;BR /&gt;&lt;BR /&gt; That is I get&amp;nbsp;only missing data for Age&amp;nbsp;when I run&lt;BR /&gt;&lt;BR /&gt; PROC SQL;&lt;BR /&gt; CREATE TABLE WORK.QUERY_FOR_Q16_0000 AS &lt;BR /&gt; SELECT t1.DateOfBirth, &lt;BR /&gt; t1.ClosureDate, &lt;BR /&gt; /* Age */&lt;BR /&gt; (((floor ((intck('month',&lt;BR /&gt;&lt;BR /&gt; T1.Dob,&lt;BR /&gt;&lt;BR /&gt; T1.cd) - (day (T1.cd) &amp;lt; day (T1.Dob)))/12) )&lt;BR /&gt; )&lt;BR /&gt; ) LABEL="Age" AS Age&lt;BR /&gt; FROM WORK.QUERY_FOR_Q16 t1;&lt;BR /&gt; QUIT;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Apr 2017 14:59:27 GMT</pubDate>
    <dc:creator>noetsi</dc:creator>
    <dc:date>2017-04-17T14:59:27Z</dc:date>
    <item>
      <title>Trouble with SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-with-SAS-dates/m-p/350527#M81483</link>
      <description>&lt;P&gt;I apologize if this has been answered - I could not find the post I did Friday.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a function I have used for years successfully to calculate age. It's&lt;BR /&gt;&lt;BR /&gt; ((floor ((intck('month',&lt;BR /&gt;&lt;BR /&gt; T1.DATEOFBIRTH,&lt;BR /&gt;&lt;BR /&gt; T1.DATEBEGIN_AT_CLO) - (day (T1.DATEBEGIN_AT_CLO) &amp;lt; day (T1.DATEOFBIRTH)))/12) )&lt;BR /&gt; )&lt;BR /&gt;&lt;BR /&gt; Where I want to calculate age at datebegin_At_Clo .The problem here is that I am starting with a date stored as a text field (I did not generate it the federal government does and I do not know how they formatted it except that it is a string).&lt;BR /&gt;&lt;BR /&gt; It is of the form '19761026' where the first four digits are the year, the next two the month and the next two the days. &lt;BR /&gt;&lt;BR /&gt; I ran &lt;BR /&gt;&lt;BR /&gt; PROC SQL;&lt;BR /&gt; CREATE TABLE WORK.QUERY_FOR_Q16 AS &lt;BR /&gt; SELECT t1.DateOfBirth, &lt;BR /&gt; t1.ClosureDate, &lt;BR /&gt; /* DOB */&lt;BR /&gt; (INPUT(t1.DateOfBirth, yyyymmdd10.)) LABEL="DOB" AS DOB, &lt;BR /&gt; /* CD */&lt;BR /&gt; (INPUT(t1.ClosureDate, yyyymmdd10.)) LABEL="CD" AS CD&lt;BR /&gt; FROM WORK.Q16 t1;&lt;BR /&gt; QUIT;&lt;BR /&gt;&lt;BR /&gt; and it appears to generate a number fine. However when I use the new fields (DOB and CD) in the age function above I get no results (not errors just no results).&lt;BR /&gt;&lt;BR /&gt; That is I get&amp;nbsp;only missing data for Age&amp;nbsp;when I run&lt;BR /&gt;&lt;BR /&gt; PROC SQL;&lt;BR /&gt; CREATE TABLE WORK.QUERY_FOR_Q16_0000 AS &lt;BR /&gt; SELECT t1.DateOfBirth, &lt;BR /&gt; t1.ClosureDate, &lt;BR /&gt; /* Age */&lt;BR /&gt; (((floor ((intck('month',&lt;BR /&gt;&lt;BR /&gt; T1.Dob,&lt;BR /&gt;&lt;BR /&gt; T1.cd) - (day (T1.cd) &amp;lt; day (T1.Dob)))/12) )&lt;BR /&gt; )&lt;BR /&gt; ) LABEL="Age" AS Age&lt;BR /&gt; FROM WORK.QUERY_FOR_Q16 t1;&lt;BR /&gt; QUIT;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 14:59:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-with-SAS-dates/m-p/350527#M81483</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2017-04-17T14:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-with-SAS-dates/m-p/350530#M81484</link>
      <description>I can't figure out how to edit my previous message. In the last set of code cd and DOB are both numbers, converted from the string in the original data base.</description>
      <pubDate>Mon, 17 Apr 2017 15:01:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-with-SAS-dates/m-p/350530#M81484</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2017-04-17T15:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-with-SAS-dates/m-p/350532#M81485</link>
      <description>&lt;P&gt;Your post from friday is here&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/problems-with-calculating-age/m-p/350206" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/problems-with-calculating-age/m-p/350206&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 15:02:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-with-SAS-dates/m-p/350532#M81485</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-04-17T15:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-with-SAS-dates/m-p/350534#M81486</link>
      <description>&lt;P&gt;Several responses in&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/problems-with-calculating-age/m-p/350206" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/problems-with-calculating-age/m-p/350206&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if you click on your user name in the upper right it will bring you to a profile page with links to your most recent posts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 15:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-with-SAS-dates/m-p/350534#M81486</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-17T15:06:33Z</dc:date>
    </item>
  </channel>
</rss>

