<?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 SAS Code for Converting Number Format into Date Format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125064#M260132</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone know how to convert number format into date format?&amp;nbsp; For example, the following shows what my data looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 64px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD align="right" height="20" width="64"&gt;20060306&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;20040727&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;20040407&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;20010423&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;All of data is shown as the number format.&amp;nbsp; I want to convert them into date format.&amp;nbsp; For example, I want to change 20060306 into 03/06/2006.&amp;nbsp; I used &lt;/P&gt;&lt;P&gt;the code: date aaa; set aaa; format varialbename mmyydd8.;run;&lt;/P&gt;&lt;P&gt;This code does not work out.&amp;nbsp; Could anyone tell me how to do it?&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Mar 2013 17:07:03 GMT</pubDate>
    <dc:creator>hongxianzhang</dc:creator>
    <dc:date>2013-03-01T17:07:03Z</dc:date>
    <item>
      <title>SAS Code for Converting Number Format into Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125064#M260132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone know how to convert number format into date format?&amp;nbsp; For example, the following shows what my data looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 64px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD align="right" height="20" width="64"&gt;20060306&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;20040727&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;20040407&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;20010423&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;All of data is shown as the number format.&amp;nbsp; I want to convert them into date format.&amp;nbsp; For example, I want to change 20060306 into 03/06/2006.&amp;nbsp; I used &lt;/P&gt;&lt;P&gt;the code: date aaa; set aaa; format varialbename mmyydd8.;run;&lt;/P&gt;&lt;P&gt;This code does not work out.&amp;nbsp; Could anyone tell me how to do it?&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 17:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125064#M260132</guid>
      <dc:creator>hongxianzhang</dc:creator>
      <dc:date>2013-03-01T17:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code for Converting Number Format into Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125065#M260133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use yymmdd8. informat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 17:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125065#M260133</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-03-01T17:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code for Converting Number Format into Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125066#M260134</link>
      <description>&lt;P&gt;Editor's Note:&amp;nbsp; hongxianzhang's code below shows how to use the&amp;nbsp;INPUT function along with the YYMMDDw.d informat, which was suggested by LinusH.&amp;nbsp; The INPUT function along with the YYMMDDw.d informat allow you to convert a numeric string in the form yymmdd into a SAS date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA SET2;
  SET SET1;
  DATE2 = INPUT(PUT(DATE1,8.),YYMMDD8.);
  FORMAT DATE2 YYMMDD8.;
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2016 20:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125066#M260134</guid>
      <dc:creator>hongxianzhang</dc:creator>
      <dc:date>2016-12-05T20:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code for Converting Number Format into Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125067#M260135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The INPUT function uses the INFORMAT, in this case YYMMDD, which has the same name as the format in the FORMAT statement in the following line.&amp;nbsp; Informats are used to read text data into (usually) numeric variables.&amp;nbsp; You used the informat correctly.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 19:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125067#M260135</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2013-03-01T19:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code for Converting Number Format into Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125068#M260136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is exactly how to use INFORMAT on an existing variable.&lt;/P&gt;&lt;P&gt;Looks like the variable is already numeric so you could store the date value into the original variable.&amp;nbsp; &lt;/P&gt;&lt;P&gt;If you want it to display the same then use YYMMDDN8, otherwise it will display two digit years and hyphens.&amp;nbsp; Or you could use YYMMDD10. to leave room for the hyphens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;DATA SET2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; SET SET1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; DATE1 = INPUT(PUT(DATE1,8.),YYMMDD8.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; FORMAT DATE1 YYMMDD10.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 19:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125068#M260136</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-03-01T19:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code for Converting Number Format into Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125069#M260137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I recently wrote a blog post relating to the put and input function that you may find useful - &lt;A class="active_link" href="http://blogs.sas.com/content/sastraining/2013/02/26/rhymes-mnemonics-and-tips-in-learning-sas/" title="http://blogs.sas.com/content/sastraining/2013/02/26/rhymes-mnemonics-and-tips-in-learning-sas/"&gt; Rhymes, mnemonics and tips in learning SAS - The SAS Training Post&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As your original variable is numeric you use the put function to convert it to a character type and then use the input function using the YYMMDD8. (as that is the way your data looks) to create the numeric SAS date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The format statement simply displays the SAS date number in the format you want, YYMMDD10. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 20:13:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-for-Converting-Number-Format-into-Date-Format/m-p/125069#M260137</guid>
      <dc:creator>MichelleHomes</dc:creator>
      <dc:date>2013-03-01T20:13:20Z</dc:date>
    </item>
  </channel>
</rss>

