<?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: Converting Character to date in sas when the format is word date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538894#M148401</link>
    <description>You will have to create a new numeric variable to store the date, then use input function with the appropriate informat to convert the string. All in a data-step. The sas online help is not that usable on mobile device, so I can't look up the format-name right now. But I am sure that you could find it yourself. &lt;BR /&gt;</description>
    <pubDate>Wed, 27 Feb 2019 06:29:43 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2019-02-27T06:29:43Z</dc:date>
    <item>
      <title>Converting Character to date in sas when the format is word date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538876#M148389</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reading from an excel file where the date is in format&amp;nbsp;25 February, 2019. This is stored as a characer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need to convert it to date format in sas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any direction&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 03:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538876#M148389</guid>
      <dc:creator>TheNovice</dc:creator>
      <dc:date>2019-02-27T03:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Character to date in sas when the format is word date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538894#M148401</link>
      <description>You will have to create a new numeric variable to store the date, then use input function with the appropriate informat to convert the string. All in a data-step. The sas online help is not that usable on mobile device, so I can't look up the format-name right now. But I am sure that you could find it yourself. &lt;BR /&gt;</description>
      <pubDate>Wed, 27 Feb 2019 06:29:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538894#M148401</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-02-27T06:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Character to date in sas when the format is word date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538897#M148403</link>
      <description>&lt;P&gt;It seems that there is no informat matching your date-format, so the string needs to modified first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   length b $ 9 d 8;
   format d yymmddd10.;

   s = '25 February, 2019';
   b = cats(scan(s, 1, ' '), substr(scan(s, 2, ', '),1, 3), scan(s, 3, ', '));
   d = input(b, date9.);

   put s= / b= / d=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 07:14:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538897#M148403</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-02-27T07:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Character to date in sas when the format is word date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538926#M148413</link>
      <description>&lt;P&gt;try this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;x='25 February, 2019';&lt;BR /&gt;dm=substr(compress(x),1,5);&lt;BR /&gt;y=substr(x,length(x)-4,5);&lt;BR /&gt;new_date=input(cats(dm,y),date9.);&lt;BR /&gt;format new_date date9.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 11:43:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538926#M148413</guid>
      <dc:creator>Riteshdell</dc:creator>
      <dc:date>2019-02-27T11:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Character to date in sas when the format is word date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538973#M148420</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;It worked!&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;I got the desired output as: &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;date = 2019-02-20&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Would it be possible for you to briefly explain in step what you did ? I have never used those functions. Really appreciate your help again.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 14:12:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538973#M148420</guid>
      <dc:creator>TheNovice</dc:creator>
      <dc:date>2019-02-27T14:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Character to date in sas when the format is word date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538975#M148421</link>
      <description>&lt;P&gt;Thank you so much Ritesh... It worked for dates in the tens but not for single digit dates like 2 January, 2019. The date came as blank.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would not mind the alternative solution. Trying to learn as much as possible&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your reply&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 14:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538975#M148421</guid>
      <dc:creator>TheNovice</dc:creator>
      <dc:date>2019-02-27T14:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Character to date in sas when the format is word date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538992#M148430</link>
      <description>&lt;P&gt;You can find long explanations in the online docs, a useful starting-point is &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=pgmsashome&amp;amp;docsetTarget=home.htm" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=pgmsashome&amp;amp;docsetTarget=home.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are some short and incomplete descriptions:&lt;/P&gt;
&lt;P&gt;cats : concatenates strings removing blanks from start and end of each string.&lt;/P&gt;
&lt;P&gt;substr(string, start, length) : starting from &lt;FONT face="courier new,courier"&gt;start&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;length&lt;/FONT&gt; chars are returned from &lt;FONT face="courier new,courier"&gt;string&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;scan(string, n, seps) : returns &lt;FONT face="courier new,courier"&gt;n&lt;/FONT&gt;-th word from &lt;FONT face="courier new,courier"&gt;string&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;seps&lt;/FONT&gt; defines the chars that are word-boundaries.&lt;/P&gt;
&lt;P&gt;input : converts string to number by using an informat&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 14:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Character-to-date-in-sas-when-the-format-is-word-date/m-p/538992#M148430</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-02-27T14:47:30Z</dc:date>
    </item>
  </channel>
</rss>

