<?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: data search engine (based on text) in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236803#M6092</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
Yes, You can in this code (word,"car","truck","ANYTHINHYOUWANT); you specify which word you need to find
find 
dataiwant created a new dataset with the result;

*/

data have dataiwant; 
input word$ 30.;
matchingword = find(word,"car","truck");
if matchingword &amp;gt; 0 then output dataiwant;
drop  matchingword;
datalines; 
A car
1 car 23j @
Car
cars
2 trucks
One truck
One truck and one car
;
run;
Proc Print data = dataiwant;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 28 Nov 2015 09:18:53 GMT</pubDate>
    <dc:creator>pearsoninst</dc:creator>
    <dc:date>2015-11-28T09:18:53Z</dc:date>
    <item>
      <title>data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236791#M6086</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppsoe that i ave the following data&amp;amp;colon;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;description&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;A car&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;1 car 23j @&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;Car&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;cars&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;2 trucks&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;One truck&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;One truck and one car&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;What I would like to have is to create a new data set where in the description either "car" or "truck" is present, so the new data table is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;description&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;A car&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;1 car 23j @&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;Car&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;One truck&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="310"&gt;
&lt;P&gt;One truck and one car&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thnak you!&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2015 01:19:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236791#M6086</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2015-11-28T01:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236793#M6087</link>
      <description>&lt;P&gt;Use IF FINDW(description, "car", " ", "i") &amp;gt; 0 OR &lt;SPAN&gt;FINDW(description, "truck", " ", "i") &amp;gt; 0;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2015 02:18:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236793#M6087</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-28T02:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236795#M6088</link>
      <description>&lt;P&gt;Alternatively you could use the perl regular expression like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;prxmatch('m/(car|truck)\b/i',description)&amp;gt;0&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Nov 2015 02:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236795#M6088</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-11-28T02:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236797#M6089</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12151"&gt;@Jagadishkatam﻿&lt;/a&gt;&amp;nbsp;you would need a word boundary before the words too 'm/\b(car|truck)\b/i', otherwise you will match anything like "I was struck by lightning"&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2015 03:07:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236797#M6089</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-28T03:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236798#M6090</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt; thank you for the correction</description>
      <pubDate>Sat, 28 Nov 2015 03:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236798#M6090</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-11-28T03:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236801#M6091</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you for replying!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just another small extension of the question, if I have a list of words, say 10, is it possible to put the list instead of each word individually?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thnka you!&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2015 06:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236801#M6091</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2015-11-28T06:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236803#M6092</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
Yes, You can in this code (word,"car","truck","ANYTHINHYOUWANT); you specify which word you need to find
find 
dataiwant created a new dataset with the result;

*/

data have dataiwant; 
input word$ 30.;
matchingword = find(word,"car","truck");
if matchingword &amp;gt; 0 then output dataiwant;
drop  matchingword;
datalines; 
A car
1 car 23j @
Car
cars
2 trucks
One truck
One truck and one car
;
run;
Proc Print data = dataiwant;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Nov 2015 09:18:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236803#M6092</guid>
      <dc:creator>pearsoninst</dc:creator>
      <dc:date>2015-11-28T09:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236813#M6093</link>
      <description>&lt;P&gt;Yes there is way to put the list into the function directly rather than passing each word, for this you need to create a macro variable which carries these words. Also it depends on the function which you are going to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, as i mentioned in the my previous reply about the prxmatch which could be used for checking the words, this function requires the words to be checked separated by pipe '|' so when you create the macro variables you need to have the words separated by pipe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try something like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select distinct words into : word separated by '|' from have;
quit;

data have;
set want;
if prxmatch('m/\b(&amp;amp;word)\b/i',description)&amp;gt;0;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Nov 2015 15:36:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236813#M6093</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-11-28T15:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236814#M6094</link>
      <description>&lt;P&gt;That is not the right syntax for the FIND() function.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2015 15:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236814#M6094</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-28T15:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236815#M6095</link>
      <description>&lt;P&gt;Don't you need to use double quotes to have the macro variable reference resolve?&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2015 15:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236815#M6095</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-28T15:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: data search engine (based on text)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236822#M6096</link>
      <description>Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; for the correction, It should be prxmatch("m/\b(&amp;amp;word)\b/i",description)&amp;gt;0;&lt;BR /&gt;replaced the single quotes with double quotes</description>
      <pubDate>Sun, 29 Nov 2015 01:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/data-search-engine-based-on-text/m-p/236822#M6096</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-11-29T01:55:28Z</dc:date>
    </item>
  </channel>
</rss>

