<?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: Recoding Date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Recoding-Date/m-p/302139#M64042</link>
    <description>&lt;P&gt;That did the trick! Thank you so much for the help. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2016 19:02:05 GMT</pubDate>
    <dc:creator>TXSASneophyte</dc:creator>
    <dc:date>2016-10-03T19:02:05Z</dc:date>
    <item>
      <title>Recoding Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-Date/m-p/302117#M64027</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling to recode DOB date values into something more useful. I am using PROC SQL to extract data from a larger dataset, and the large dataset has the DOB as "yyyymmdd"&amp;nbsp;format &lt;SPAN&gt;(looks like this:&lt;/SPAN&gt;&lt;SPAN&gt;19860222 )&lt;/SPAN&gt;&amp;nbsp;and I want to convert it to date9.&amp;nbsp;format (to look like this: 22FEB1986). My failed code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE NEW_DATASET&amp;nbsp;AS&lt;BR /&gt;SELECT ID,&lt;BR /&gt;SEX,&lt;BR /&gt;RACE,&lt;BR /&gt;&lt;STRONG&gt;DOB INFORMAT = DATE9. FORMAT= DATE9.,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ENC_MNTH&lt;BR /&gt;FROM SOURCE_DATASET&lt;BR /&gt;WHERE 200701 &amp;lt;= ENC_MNTH&amp;lt;= 201509&lt;BR /&gt;ORDER BY ID, ENC_MNTH;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nothing happens to DOB with this code. Does someone have a fixed to the problem? If possible, please keep it in the proc sql format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS 9.4.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Muchas Gracias.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 17:48:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-Date/m-p/302117#M64027</guid>
      <dc:creator>TXSASneophyte</dc:creator>
      <dc:date>2016-10-03T17:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-Date/m-p/302133#M64038</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the DOB is a numeric value to begin with, you must first&amp;nbsp;convert it to character that is in the format MMDDYYYY by isolating the the digits for year, month, and day. You can do this by using the substr function along with the input/put functions and then combine all three susbtrings using the cats function. So now we have a modified date input. Now, turn it into a numeric SAS date field by using the input function and anydtdte informat. And finally add a format statement at the end of the select as you did.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE NEW_DATASET AS
SELECT ID,
SEX,
RACE,
input(cats(substr(put(DOB,8.),5,2),substr(put(DOB,8.),7,2),substr(put(DOB,8.
),1,4)),anydtdte.) format DATE9. AS DOB
ENC_MNTH
FROM SOURCE_DATASET
WHERE 200701 &amp;lt;= ENC_MNTH&amp;lt;= 201509
ORDER BY ID, ENC_MNTH;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 20:25:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-Date/m-p/302133#M64038</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2016-10-03T20:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-Date/m-p/302139#M64042</link>
      <description>&lt;P&gt;That did the trick! Thank you so much for the help. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 19:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-Date/m-p/302139#M64042</guid>
      <dc:creator>TXSASneophyte</dc:creator>
      <dc:date>2016-10-03T19:02:05Z</dc:date>
    </item>
  </channel>
</rss>

