<?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: Need to identify a group of strings in a field in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168971#M43691</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it will not eliminate quotes that aren't part of phrase.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Jan 2015 00:42:57 GMT</pubDate>
    <dc:creator>stat_sas</dc:creator>
    <dc:date>2015-01-06T00:42:57Z</dc:date>
    <item>
      <title>Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168963#M43683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a requirement like this: There are some frequently quoted phrases. If Company_name contains one of these frequently quoted phrases in quotes, then we need to remove the quotes and the characters contained within them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please help to achieve this? I have 230 million company names and 25 frequently quoted phrases. I have to search 230mm company names for these 25 phrases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample Data is like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Company Names: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Baldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Maldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanoverrriging "De Surdelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Udadelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Peddelaars"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frequently quoted phrases:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;De Peddelaars&lt;/P&gt;&lt;P&gt;De Surdelaars&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expected output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Baldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Maldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanoverrriging&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Udadelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 12:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168963#M43683</guid>
      <dc:creator>gandikk</dc:creator>
      <dc:date>2015-01-05T12:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168964#M43684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hash Table :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data a;
input name &amp;amp; $80.;
cards;
Awolsk Kanovereniging "De Baldelaars"
Awolsk Kanovereniging "De Maldelaars"
Awolsk Kanoverrriging "De Surdelaars"
Awolsk Kanovereniging "De Udadelaars"
Awolsk Kanovereniging "De Peddelaars"
;
run;
data b;
input key &amp;amp; $40.;
cards;
De Peddelaars
De Surdelaars
;
run;
data want;
 if _n_ eq 1 then do;
&amp;nbsp; if 0 then set a;
&amp;nbsp; declare hash h(dataset:'b');
&amp;nbsp; h.definekey('key');
&amp;nbsp; h.definedone();
 end;
set a;
 key=scan(trim(name),-1,'"');
 if h.check()=0 then name=scan(name,1,'"');
 drop key;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 13:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168964#M43684</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-05T13:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168965#M43685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sure there's a way to do it with hash tables...but here's a relatively straight forward approach:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data companies;&lt;/P&gt;&lt;P&gt;format Company_Name $50.;&lt;/P&gt;&lt;P&gt;input Company_Name $50.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Baldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Maldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanoverrriging "De Surdelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Udadelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Peddelaars"&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data patterns;&lt;/P&gt;&lt;P&gt;format Phrase $50.;&lt;/P&gt;&lt;P&gt;input Phrase $50.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;"De Peddelaars"&lt;/P&gt;&lt;P&gt;"De Surdelaars"&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tranwrd(c.company_name,trim(p.phrase),'') as test&lt;/P&gt;&lt;P&gt;from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; companies c &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; left outer join&amp;nbsp; patterns p&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on c.company_name like cats("%",p.phrase,"%");&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;produces&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging&lt;/P&gt;&lt;P&gt;Awolsk Kanoverrriging&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Baldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Maldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Udadelaars"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 13:11:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168965#M43685</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2015-01-05T13:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168966#M43686</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;The only thing I would add is a couple of other options to do the code (as 230m records might cause some disk space issues with create table):&lt;/P&gt;&lt;P&gt;The first I thought of was update table, however you may also run into space issues.&lt;/P&gt;&lt;P&gt;The other is to generate a datastep from your source data (which may be more resource efficient):&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set patterns end=last;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _n_=1 then call execute('data companies; set companies;');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute(' company_name=tranwrd(company_name,'||"'"||strip(phrase)||"'"||',"");');&amp;nbsp;&amp;nbsp; /* Note single and double quotes! */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last then call execute(' run;');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A final option is to move the quote to a new field using " as a delimiter, then its a simple where clause.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 13:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168966#M43686</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-05T13:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168967#M43687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would contains operator be better ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; c.company_name contains strip(p.phrase)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 13:28:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168967#M43687</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-05T13:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168968#M43688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure.&amp;nbsp; Might have to test that. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as table size, it always depends on where the original data lives.&amp;nbsp; If it is a SAS dataset, then using a hash function in conjunction with a data step modify&amp;nbsp; might be fastest.&amp;nbsp; If the source is some other data management system (i.e. Oracle), then you'll probably have to create a separate dataset anyway.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 15:37:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168968#M43688</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2015-01-05T15:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168969#M43689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want(drop=phrase);&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;length phrase $20;&lt;/P&gt;&lt;P&gt;do phrase = 'De Peddelaars', 'De Surdelaars'; &lt;/P&gt;&lt;P&gt;&amp;nbsp; company_name = tranwrd(strip(company_name),'"'||strip(phrase)||'"','');&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 16:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168969#M43689</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2015-01-05T16:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168970#M43690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wouldn't that eliminate the quotes even when they aren't part of the phrase that's being suppressed?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 17:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168970#M43690</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2015-01-05T17:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168971#M43691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it will not eliminate quotes that aren't part of phrase.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 00:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168971#M43691</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2015-01-06T00:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168972#M43692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming these 25 phrases are not too long using a regular expression could be worth trying. Below example uses the SAS function prxchange().&lt;/P&gt;&lt;P&gt;A lot of data bases have their own implementation of similar functions so if the data is stored in a data base you could implement using explicit pass-through using the similar db function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data companies;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format Company_Name $50.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Company_Name $50.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Baldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Maldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanoverrriging "De Surdelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Udadelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Peddelaars"&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data patterns;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format Phrase $50.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Phrase $50.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;De Peddelaars&lt;/P&gt;&lt;P&gt;De Surdelaars&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select cats('"',Phrase,'"') into :pattern_list separated by '|'&lt;/P&gt;&lt;P&gt;&amp;nbsp; from patterns&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%put xxx: %bquote(&amp;amp;pattern_list);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let reg_ex=%str(%')s/&amp;amp;pattern_list//oi%str(%');&lt;/P&gt;&lt;P&gt;%put yyy: &amp;amp;reg_ex;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Company_Name,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prxchange(%unquote(&amp;amp;reg_ex),1,company_name) as Company_Name_Cleansed format=$50.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from companies&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 03:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168972#M43692</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-01-06T03:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168973#M43693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick,&lt;/P&gt;&lt;P&gt;As far as I know there is a limitation of the number of matched string for prxchange(.) . I don't know if prxchange() is good enough to hold all of those OP's key string .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 06:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168973#M43693</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-06T06:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168974#M43694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="645292" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;There will certainly be a limit both for the length and number of elements of a RegEx string as well as some point where the number of OR conditions becomes inefficient. I don't know though where these limits are and could only find out with try and error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It appears to work with 26 "phrases" though. If this is more or less efficient than the other approaches suggested would need testing with real data and volumes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here the code with 26 "phrases". I needed to use "options noquotelenmax;" in order to suppress the warning created by a macro variable string longer than 256 characters used as regular expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data companies;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format Company_Name $50.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Company_Name $50.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Baldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Maldelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanoverrriging "De Surdelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Udadelaars"&lt;/P&gt;&lt;P&gt;Awolsk Kanovereniging "De Peddelaars"&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data patterns(drop=_:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; format Phrase $50.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Phrase $50.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _Phrase=Phrase;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do _i=1 to 12;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Phrase=cats(_Phrase,_i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Phrase=_Phrase;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;De Peddelaars&lt;/P&gt;&lt;P&gt;De Surdelaars&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select cats('"',Phrase,'"') into :pattern_list separated by '|'&lt;/P&gt;&lt;P&gt;&amp;nbsp; from patterns&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%put xxx: %bquote(&amp;amp;pattern_list);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let reg_ex=%str(%')s/&amp;amp;pattern_list//oi%str(%');&lt;/P&gt;&lt;P&gt;%put yyy: &amp;amp;reg_ex;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options noquotelenmax;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Company_Name,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prxchange(%unquote(&amp;amp;reg_ex),1,company_name) as Company_Name_Cleansed format=$50.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from companies&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;options quotelenmax;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 00:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168974#M43694</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-01-07T00:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168975#M43695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It might be worth trying to update instead of creating a new copy of the table. Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data a;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input name &amp;amp; $80.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Awolsk Kanovereniging "De Baldelaars"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Awolsk Kanovereniging "De Maldelaars"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Awolsk Kanoverrriging "De Surdelaars"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Awolsk Kanovereniging "De Udadelaars"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Awolsk Kanovereniging "De Peddelaars"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;filename t TEMP;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data _null_;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input key &amp;amp; $40.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;line = cats(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'update a set name = tranwrd(name, """', &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; key,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '""","") where name contains """',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; key,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '""";'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ); &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;file t;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;put line;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;De Peddelaars&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;De Surdelaars&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%include t / source2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally, SAS/SQL would get the updates done on the DBMS server, if that's where the data resides.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 04:12:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168975#M43695</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-01-07T04:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Need to identify a group of strings in a field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168976#M43696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. We tried Hash instead of SQL. This worked as per the requirement. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 11:11:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-to-identify-a-group-of-strings-in-a-field/m-p/168976#M43696</guid>
      <dc:creator>gandikk</dc:creator>
      <dc:date>2015-01-07T11:11:31Z</dc:date>
    </item>
  </channel>
</rss>

