<?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: convert character to date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727816#M226436</link>
    <description>If the original dates are YYMMDD you need to use a YYMMDD informat, not a MMDDYY informat in your INPUT function.</description>
    <pubDate>Fri, 19 Mar 2021 17:13:24 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-03-19T17:13:24Z</dc:date>
    <item>
      <title>convert character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727799#M226429</link>
      <description>&lt;P&gt;I have the following dataset where both 'Date' and 'Value' are in character format. I would like to convert Date from character to date field and Value from character to numeric using proc sql; command. I am unable to convert the Date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2020-01-01&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2020-04-01&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2020-05-09&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2020-09-04&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table test as&lt;/P&gt;&lt;P&gt;select ID, input(Date, mmddyy10.) as DateNew format=mmddyy10.,&lt;/P&gt;&lt;P&gt;input(Value, best.) as Value&lt;/P&gt;&lt;P&gt;from have;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the Value is being converted properly but not Date. It shows an error that invalid or missing/error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Invalid date value&lt;/P&gt;&lt;P&gt;NOTE: Invalid argument to function INPUT. Missing values may be generated.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 17:00:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727799#M226429</guid>
      <dc:creator>pacman94</dc:creator>
      <dc:date>2021-03-19T17:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727800#M226430</link>
      <description>&lt;P&gt;When you have code that is causing an error, SHOW US THE LOG. The entire log for PROC SQL, every single word, in the sequence that it appears, with nothing chopped out. Please format the log properly by clicking on the &amp;lt;/&amp;gt; icon and pasting the log as text into the window that appears; this makes the log more readable (and I no longer try to read logs that aren't formatted this way).&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 16:34:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727800#M226430</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-03-19T16:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727804#M226432</link>
      <description>&lt;P&gt;I edited the text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Invalid date value&lt;/P&gt;&lt;P&gt;NOTE: Invalid argument to function INPUT. Missing values may be generated.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 16:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727804#M226432</guid>
      <dc:creator>pacman94</dc:creator>
      <dc:date>2021-03-19T16:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727808#M226433</link>
      <description>Show more of the log as it will contain the rest of the information. &lt;BR /&gt;Is it possible the dates are ddmmyy instead?&lt;BR /&gt;Or do you have missing dates or values? This code doesn't handle that case and that would generate the error you're seeing as well. &lt;BR /&gt;&lt;BR /&gt;Your code is correct so this is a data specific issue. &lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2021 16:55:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727808#M226433</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-19T16:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727812#M226434</link>
      <description>&lt;P&gt;I see . the original dates are in YYYY-MM-DD format. I tried different combinations . There are no missing dates&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 17:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727812#M226434</guid>
      <dc:creator>pacman94</dc:creator>
      <dc:date>2021-03-19T17:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727816#M226436</link>
      <description>If the original dates are YYMMDD you need to use a YYMMDD informat, not a MMDDYY informat in your INPUT function.</description>
      <pubDate>Fri, 19 Mar 2021 17:13:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727816#M226436</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-19T17:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727903#M226465</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/360798"&gt;@pacman94&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I edited the text&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;lt;/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Invalid date value&lt;/P&gt;
&lt;P&gt;NOTE: Invalid argument to function INPUT. Missing values may be generated.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is not the ENTIRE log for PROC SQL that I asked for, and it needs to be formatted properly, as I described. What you have provided is part of the log, detached from the rest of the log and detached from the code that created the error, is not useful.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Mar 2021 12:20:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727903#M226465</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-03-20T12:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727912#M226471</link>
      <description>&lt;P&gt;Your strings are not in&amp;nbsp; Month Day Year order like you told the INPUT() function they were.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your strings are in Year Month Day order.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; input(Date, yymmdd10.) &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 20 Mar 2021 15:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-date/m-p/727912#M226471</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-20T15:09:54Z</dc:date>
    </item>
  </channel>
</rss>

