<?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: Extract Dates from text string &amp; change to date foramt in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95399#M26993</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reeza, Thank you. Can you be more specific? I cannot figure out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Feb 2013 20:15:00 GMT</pubDate>
    <dc:creator>Anna_Guo</dc:creator>
    <dc:date>2013-02-02T20:15:00Z</dc:date>
    <item>
      <title>Extract Dates from text string &amp; change to date foramt</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95397#M26991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I want to extract dates from a text string, most of them are at the same place,&amp;nbsp; But some have two dates&amp;nbsp; and may be in different places.&amp;nbsp;&amp;nbsp; I can&amp;nbsp; use substrn function to get most of the dates. Any one has better way to do it? In addition, after &lt;SPAN style="font-size: 14pt;"&gt;substrn&lt;/SPAN&gt;, they are in text format, how can I change to &lt;SPAN style="font-size: 14pt;"&gt;the date format &lt;/SPAN&gt;still keeping the correct date value?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I attached the simplified sas file, my actual file imuch larger.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2013 17:08:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95397#M26991</guid>
      <dc:creator>Anna_Guo</dc:creator>
      <dc:date>2013-02-02T17:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Dates from text string &amp; change to date foramt</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95398#M26992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like you have multiple dates but the text is separated by ;. &lt;/P&gt;&lt;P&gt;You could try using the scan function instead to get the date parts. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd use two nested loops, one that first scans for ; and the find/index with substr to find the date parts.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2013 19:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95398#M26992</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-02-02T19:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Dates from text string &amp; change to date foramt</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95399#M26993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reeza, Thank you. Can you be more specific? I cannot figure out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2013 20:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95399#M26993</guid>
      <dc:creator>Anna_Guo</dc:creator>
      <dc:date>2013-02-02T20:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Dates from text string &amp; change to date foramt</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95400#M26994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would use a regular expression.&amp;nbsp; The following will work and, hopefully, someone with more regex expertise can simplify it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname art "c:\art";&lt;/P&gt;&lt;P&gt;%let pattern=\d{1,2}\/\d{1,2}\/\d{2,4};&lt;/P&gt;&lt;P&gt;data want (drop=pos: len: prx:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set art.test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date1 date2 mmddyy10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; prxid1=prxparse("/&amp;amp;pattern./o");&lt;/P&gt;&lt;P&gt;&amp;nbsp; prxid2=prxparse("/&amp;amp;pattern..*?(&amp;amp;pattern.)/o");&lt;/P&gt;&lt;P&gt;&amp;nbsp; if prxmatch(prxid1,INITIAL_CALL_DATA) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALL PRXSUBSTR (prxid1, INITIAL_CALL_DATA, position , length);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date1=input(substr(INITIAL_CALL_DATA, position , length),mmddyy10.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if prxmatch(prxid2,INITIAL_CALL_DATA) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALL PRXSUBSTR (prxid1, substr(INITIAL_CALL_DATA, position+5),position2,length2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date2=input(substr(INITIAL_CALL_DATA, position+4+position2 , length2),mmddyy10.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2013 20:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95400#M26994</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-02T20:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Dates from text string &amp; change to date foramt</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95401#M26995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arthur,&lt;/P&gt;&lt;P&gt;Thank you very much. It worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2013 20:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Extract-Dates-from-text-string-change-to-date-foramt/m-p/95401#M26995</guid>
      <dc:creator>Anna_Guo</dc:creator>
      <dc:date>2013-02-02T20:34:02Z</dc:date>
    </item>
  </channel>
</rss>

