<?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 for various strings with a variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519415#M3797</link>
    <description>&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if prxmatch('/xx|yy|zz|aa|bb|cc/',long_string) then found=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;else found=0;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Dec 2018 13:38:09 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-12-07T13:38:09Z</dc:date>
    <item>
      <title>Search for various strings with a variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519405#M3788</link>
      <description>&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is search for a string within a large text&amp;nbsp; string.&lt;/P&gt;&lt;P&gt;So I will have around 100 products for instance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to know is if any of these 100 products appear in a larger text string (which will have a lot of junk text but will have the product name in places) stored in a different table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am thinking I will need some sort of loop but not certain if their is an easier way to achieve this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions or helpful link or examples would be fantastic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Aidan&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 13:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519405#M3788</guid>
      <dc:creator>Aidan</dc:creator>
      <dc:date>2018-12-07T13:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: Search for various strings with a variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519413#M3795</link>
      <description>&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if prxmatch('/xx|yy|zz|aa|bb|cc/',long_string) then found=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;else found=0;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 13:37:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519413#M3795</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-12-07T13:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Search for various strings with a variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519414#M3796</link>
      <description>&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if prxmatch('/xx|yy|zz|aa|bb|cc/',long_string) then found=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;else found=0;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 13:38:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519414#M3796</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-12-07T13:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Search for various strings with a variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519415#M3797</link>
      <description>&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if prxmatch('/xx|yy|zz|aa|bb|cc/',long_string) then found=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;else found=0;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 13:38:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519415#M3797</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-12-07T13:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Search for various strings with a variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519416#M3798</link>
      <description>&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont think this will work for me, thanks all the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found something below;&lt;/P&gt;&lt;P&gt;data _NULL_;&lt;BR /&gt;set &amp;amp;_INPUT1 end=last;&lt;BR /&gt;if _n_=1 then call execute('data want; set &amp;amp;_INPUT2; length wordsfound $50;');&lt;BR /&gt;call execute('if findw(LOG_NOTES,"'||strip(word)||'") &amp;gt;0 then wordsfound=catx(",",wordsfound,"'||strip(word)||'");');&lt;BR /&gt;if last then call execute('run;');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems to work to some extent but it wont return any value for wordsfound, just set to null&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 13:43:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519416#M3798</guid>
      <dc:creator>Aidan</dc:creator>
      <dc:date>2018-12-07T13:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Search for various strings with a variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519419#M3800</link>
      <description>got it working using this thanks anyway &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 07 Dec 2018 13:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519419#M3800</guid>
      <dc:creator>Aidan</dc:creator>
      <dc:date>2018-12-07T13:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Search for various strings with a variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519420#M3801</link>
      <description>&lt;P&gt;This part of the code from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;'/xx|yy|zz|aa|bb|cc/'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;can be created easily by PROC SQL. So assume the 100&amp;nbsp;product names are in a SAS data set named PRODUCT_NAMES (one product name on each row)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Then&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    select distinct name into :names separated by '|' from product_names;
quit;

%let names1=%str(%')/&amp;amp;names/%str(%');

data want;
    set have;
    if prxmatch(%unquote(&amp;amp;names1),long_string) then found=1;
    else found=0;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 13:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Search-for-various-strings-with-a-variable/m-p/519420#M3801</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-12-07T13:58:33Z</dc:date>
    </item>
  </channel>
</rss>

