<?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: how to convert text field(32767) to date field with date9. format? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-text-field-32767-to-date-field-with-date9-format/m-p/832135#M328887</link>
    <description>&lt;P&gt;If datesent is indeed like 2022-01-13 then you want a YYMMDD10. informat not Date9. Input uses the layout of the field, not how you think you want it to look to read the data.&lt;/P&gt;
&lt;PRE&gt;datesent1 = input ( datesent, yymmdd10.);&lt;/PRE&gt;
&lt;P&gt;I am a little concerned about the datesent is 32K characters though. If any of the extra characters come before the date bit then you need to remove them as leading spaces would be significant and might require&lt;/P&gt;
&lt;PRE&gt;datesent1 = input ( strip(datesent), yymmdd10.);&lt;/PRE&gt;</description>
    <pubDate>Wed, 07 Sep 2022 14:57:40 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-09-07T14:57:40Z</dc:date>
    <item>
      <title>how to convert text field(32767) to date field with date9. format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-text-field-32767-to-date-field-with-date9-format/m-p/832125#M328884</link>
      <description>&lt;P&gt;I have two fields &lt;STRONG&gt;datesent&lt;/STRONG&gt;&amp;nbsp;(Ex: 2022-01-13) is text field with length 32767 and &lt;STRONG&gt;collection_date(Ex:22JAN2022)&lt;/STRONG&gt; is number with Date9. format&lt;BR /&gt;would like to compare and get line list of records where datesent &amp;lt; collection_date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tried the following to convert datesent but it's not working..&lt;/P&gt;
&lt;P&gt;data temp2;&lt;BR /&gt;set temp;&lt;BR /&gt;format datesent1 date9.;&lt;BR /&gt;datesent1 = input ( datesent, date9.);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 14:29:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-text-field-32767-to-date-field-with-date9-format/m-p/832125#M328884</guid>
      <dc:creator>Stalk</dc:creator>
      <dc:date>2022-09-07T14:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert text field(32767) to date field with date9. format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-text-field-32767-to-date-field-with-date9-format/m-p/832135#M328887</link>
      <description>&lt;P&gt;If datesent is indeed like 2022-01-13 then you want a YYMMDD10. informat not Date9. Input uses the layout of the field, not how you think you want it to look to read the data.&lt;/P&gt;
&lt;PRE&gt;datesent1 = input ( datesent, yymmdd10.);&lt;/PRE&gt;
&lt;P&gt;I am a little concerned about the datesent is 32K characters though. If any of the extra characters come before the date bit then you need to remove them as leading spaces would be significant and might require&lt;/P&gt;
&lt;PRE&gt;datesent1 = input ( strip(datesent), yymmdd10.);&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Sep 2022 14:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-text-field-32767-to-date-field-with-date9-format/m-p/832135#M328887</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-09-07T14:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert text field(32767) to date field with date9. format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-text-field-32767-to-date-field-with-date9-format/m-p/832136#M328888</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; With the INPUT function, you need to use an INFORMAT that matches the character string. You want the converted number to use the DATE9. format. But you want your character string to be converted using the &lt;STRONG&gt;yymmdd10.&lt;/STRONG&gt; INFORMAT. Otherwise, my guess is that you are seeing error messages in the log like:&lt;FONT face="courier new,courier" color="#0000FF"&gt;&lt;STRONG&gt; NOTE: Invalid argument to function INPUT at line xxx column yy.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Just remember that you are essentially converting the character string from how it looks as a date (yymmdd10.) into a number that is the number of days since Jan 1, 1960. That converted number should be displayed with the DATE9. format. So your FORMAT statement is OK. Your INFORMAT in the INPUT function just needs to be fixed.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 14:58:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-text-field-32767-to-date-field-with-date9-format/m-p/832136#M328888</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-09-07T14:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert text field(32767) to date field with date9. format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-text-field-32767-to-date-field-with-date9-format/m-p/832192#M328913</link>
      <description>Cynthia, You are right about the Note. Followed your suggestion and made the changes. It worked.&lt;BR /&gt;Thank you both</description>
      <pubDate>Wed, 07 Sep 2022 17:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-text-field-32767-to-date-field-with-date9-format/m-p/832192#M328913</guid>
      <dc:creator>Stalk</dc:creator>
      <dc:date>2022-09-07T17:51:51Z</dc:date>
    </item>
  </channel>
</rss>

