<?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: search with text in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179106#M45729</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for looking into the issue. Id 101 should also captured as it contain date (03 Apr 2101)&amp;nbsp; &amp;gt; current date (20 Nov 2014). Could you please look. Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Nov 2014 11:52:27 GMT</pubDate>
    <dc:creator>Abraham</dc:creator>
    <dc:date>2014-11-20T11:52:27Z</dc:date>
    <item>
      <title>search with text</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179104#M45727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the below dataset, I would like to search ID value if the date present in the variable "text" &amp;gt; today's date.&lt;/P&gt;&lt;P&gt;e.g.Output value should be 101 and 104&lt;/P&gt;&lt;P&gt;because for 101, date available is 03 Apr 2101 which is greater than today'date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 104, same (01 Jan 2017)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data abcl;&lt;/P&gt;&lt;P&gt;input id text : &amp;amp; $200.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;101 Prime Minister has arrived in Melbourne for the final leg of his four-city tour of Australia on 01 Mar 2014&amp;nbsp; and 03 Apr 2101' &lt;/P&gt;&lt;P&gt;102 The 234/12 advance rfff1111eading of Singapore third quarter on 01 Dec 2012 showing no response&lt;/P&gt;&lt;P&gt;103 There is no symptom minister Malaria after 20 Nov 2014 meaning vaccine work properly&lt;/P&gt;&lt;P&gt;104 The total cost of the conversion is a nonnegative value that is usually seen on 01 Jan 2017 showing 10 people's work&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 10:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179104#M45727</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2014-11-20T10:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: search with text</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179105#M45728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Well the main bit is finding the date in the text.&amp;nbsp; In the below I use an array to find the month (note the spaces around it so I don't mistake other text), then its quite simple.&amp;nbsp; I leave each bit as a separate step so you can see the working.&amp;nbsp; You can combine this of course.&lt;/P&gt;&lt;P&gt;data abcl;&lt;BR /&gt;&amp;nbsp; input id text : &amp;amp; $200.;&lt;BR /&gt;cards;&lt;BR /&gt;101 Prime Minister has arrived in Melbourne for the final leg of his four-city tour of Australia on 01 Mar 2014&amp;nbsp; and 03 Apr 2101' &lt;BR /&gt;102 The 234/12 advance rfff1111eading of Singapore third quarter on 01 Dec 2012 showing no response&lt;BR /&gt;103 There is no symptom minister Malaria after 20 Nov 2014 meaning vaccine work properly&lt;BR /&gt;104 The total cost of the conversion is a nonnegative value that is usually seen on 01 Jan 2017 showing 10 people's work&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want (drop=i mnths1-mnths12 start);&lt;BR /&gt;&amp;nbsp; set abcl;&lt;BR /&gt;&amp;nbsp; array mnths{12} $5. (" Jan "," Feb "," Mar "," Apr "," May "," Jun "," Jul "," Aug "," Sep "," Oct "," Nov "," Dec ");&lt;BR /&gt;&amp;nbsp; do i=1 to 12;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if index(text,mnths{i}) &amp;gt; 0 then start=index(text,mnths{i}) - 3;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; if start &amp;gt; 0 then dte=input(compress(substr(text,start,12)),date9.);&lt;BR /&gt;&amp;nbsp; if dte &amp;gt; today() then output;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 11:35:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179105#M45728</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-20T11:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: search with text</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179106#M45729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for looking into the issue. Id 101 should also captured as it contain date (03 Apr 2101)&amp;nbsp; &amp;gt; current date (20 Nov 2014). Could you please look. Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 11:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179106#M45729</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2014-11-20T11:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: search with text</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179107#M45730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that's because I am only searching for 1 date.&amp;nbsp; How many is there likely to be?&amp;nbsp; Do you want one row output per date which complies etc?&amp;nbsp; I don't know your full requirements so you will need to modify a bit.&amp;nbsp; This should cover multiple dates, but will output once per date fulfilling criteria:&lt;/P&gt;&lt;P&gt;data abcl;&lt;BR /&gt;&amp;nbsp; length text $2000.;&lt;BR /&gt;&amp;nbsp; infile datalines&amp;nbsp; dlm="¬";&lt;BR /&gt;&amp;nbsp; input id text $;&lt;BR /&gt;cards;&lt;BR /&gt;101¬Prime Minister has arrived in Melbourne for the final leg of his four-city tour of Australia on 01 Mar 2014&amp;nbsp; and 03 Apr 2101' &lt;BR /&gt;102¬The 234/12 advance rfff1111eading of Singapore third quarter on 01 Dec 2012 showing no response&lt;BR /&gt;103¬There is no symptom minister Malaria after 20 Nov 2014 meaning vaccine work properly&lt;BR /&gt;104¬The total cost of the conversion is a nonnegative value that is usually seen on 01 Jan 2017 showing 10 people's work&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want (drop=i mnths1-mnths12);&lt;BR /&gt;&amp;nbsp; set abcl;&lt;BR /&gt;&amp;nbsp; array mnths{12} $5. (" Jan "," Feb "," Mar "," Apr "," May "," Jun "," Jul "," Aug "," Sep "," Oct "," Nov "," Dec ");&lt;BR /&gt;&amp;nbsp; array dtes{10} 8.;&lt;BR /&gt;&amp;nbsp; format dtes1-dtes10 date9.;&lt;BR /&gt;&amp;nbsp; c=1;&lt;BR /&gt;&amp;nbsp; do i=1 to 12;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if index(text,mnths{i}) &amp;gt; 0 then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtes{c}=input(compress(substr(text,index(text,mnths{i}) - 3,12)),date9.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c=c+1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; do i=1 to 10;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if dtes{i} &amp;gt; today() then output;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 12:00:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179107#M45730</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-20T12:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: search with text</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179108#M45731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data abcl(keep=id text);&lt;/P&gt;&lt;P&gt;input id text : &amp;amp; $200.;&lt;/P&gt;&lt;P&gt;format date date9.;&lt;/P&gt;&lt;P&gt;if _N_ = 1 then&lt;/P&gt;&lt;P&gt;do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain rId;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rId = prxparse('/\d{2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4}/i');&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;start = 1;&lt;/P&gt;&lt;P&gt;stop = length(text);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;call prxnext(rId, start, stop, text, position, length);&lt;/P&gt;&lt;P&gt;do while (position &amp;gt; 0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; date = input(substr(text, position, length),date11.); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call prxnext(rId, start, stop, text, position, length);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if date &amp;gt; date() then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; continue;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;101 Prime Minister has arrived in Melbourne for the final leg of his four-city tour of Australia on 01 Mar 2014 and 03 Apr 2101'&lt;/P&gt;&lt;P&gt;102 The 234/12 advance rfff1111eading of Singapore third quarter on 01 Dec 2012 showing no response&lt;/P&gt;&lt;P&gt;103 There is no symptom minister Malaria after 20 Nov 2014 meaning vaccine work properly&lt;/P&gt;&lt;P&gt;104 The total cost of the conversion is a nonnegative value that is usually seen on 01 Jan 2017 showing 10 people's work&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 12:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/search-with-text/m-p/179108#M45731</guid>
      <dc:creator>Vladislaff</dc:creator>
      <dc:date>2014-11-20T12:01:15Z</dc:date>
    </item>
  </channel>
</rss>

