<?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: &amp;quot;prxmatch&amp;quot; between two DB in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849390#M335818</link>
    <description>&lt;P&gt;If your dataset with list of words to look for is relatively small, if may be better to put all the words in a macro list with "|" between:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  do until(done);
    set list2 end=done;
    length words $200;
    call catx('|',words,c);
    end; 
  call symputx('words',words);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use that in a PRXMATCH function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table want2 as
  select * from have
  where prxmatch("/(&amp;amp;words)/i",catx(',',a,b));
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It looks to me like the words you are looking for all come right after a word boundary. If you want to implement that in the PRX expression, just change the PRXMATCH call to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;prxmatch("/\b(&amp;amp;words)/i",catx(',',a,b));&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 13 Dec 2022 12:33:49 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2022-12-13T12:33:49Z</dc:date>
    <item>
      <title>"prxmatch" between two DB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849373#M335814</link>
      <description>&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;Buongiorno vorrei utilizzare la funzione "prxmatch" tra due DB. Vorrei utilizzare questa funzione e non altre per le molteplici caratteristiche della ricerca (indifferentemente maiuscolo / minuscolo ecc...). Allego un passo di data come esempio. Tnks&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
a = 'emil, Nordpole, richard, Theo'; b = 'something, somethingelse'; output;
a = 'sandman, emil, peter'; b = 'whatever'; output;
a = 'samuel'; b = 'anoterexample'; output;
a = 'stephany'; b = 'lookingforwordshere'; output;
run;

data list2;
c = 'nordpole';output;
c= 'pet';output;
c='lookingforwords'; output;
run;


%macro quickndirty(varlist);

%let varlist = %upcase(&amp;amp;varlist.);

proc sql;
create table want2 as
select * from have
where 1=0
      %do i=1 %to %sysfunc(countw(&amp;amp;varlist.));
        %let next_name = %scan(&amp;amp;varlist., &amp;amp;i.);
        or upcase(a) prxmatch "&amp;amp;next_name."
        or upcase(b) prxmatch "&amp;amp;next_name."
      %end;
;quit;
%mend;

%quickndirty(&amp;amp;list2.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 11:15:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849373#M335814</guid>
      <dc:creator>Tecla1</dc:creator>
      <dc:date>2022-12-13T11:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: "prxmatch" between two DB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849384#M335815</link>
      <description>&lt;P&gt;Hi, I know there is no Italian hub here at communities (maybe something to root for?).&lt;/P&gt;
&lt;P&gt;Here is your question through &lt;STRONG&gt;Google translate&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;Hello I would like to use the "prxmatch" function between two DBs. I would like to use this function and not others due to the multiple characteristics of the search (indifferently case sensitive, etc...). I am attaching a date passage as an example.&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could please describe concretely what you need help with?&lt;/P&gt;
&lt;P&gt;What does your current lack?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 12:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849384#M335815</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2022-12-13T12:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: "prxmatch" between two DB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849386#M335816</link>
      <description>Il codice che ho allegato restituisce errore, l'ho inserito come traccia per rendere più facile spiegare quello che voglio fare. Tutti gli esempi con "PRXmatch" sono fatti inserendo direttamente nel passo di data il testo o i digit da cercare, io vorrei inserire il testo da cercare in una tabella (o DB). Grazie per la risposta.</description>
      <pubDate>Tue, 13 Dec 2022 12:20:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849386#M335816</guid>
      <dc:creator>Tecla1</dc:creator>
      <dc:date>2022-12-13T12:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: "prxmatch" between two DB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849390#M335818</link>
      <description>&lt;P&gt;If your dataset with list of words to look for is relatively small, if may be better to put all the words in a macro list with "|" between:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  do until(done);
    set list2 end=done;
    length words $200;
    call catx('|',words,c);
    end; 
  call symputx('words',words);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use that in a PRXMATCH function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table want2 as
  select * from have
  where prxmatch("/(&amp;amp;words)/i",catx(',',a,b));
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It looks to me like the words you are looking for all come right after a word boundary. If you want to implement that in the PRX expression, just change the PRXMATCH call to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;prxmatch("/\b(&amp;amp;words)/i",catx(',',a,b));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Dec 2022 12:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849390#M335818</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2022-12-13T12:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: "prxmatch" between two DB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849392#M335819</link>
      <description>Grazie, provo. Quindi in realtà non c'è un modo per poterlo eseguire senza il passaggio "catx".&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Dec 2022 12:38:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849392#M335819</guid>
      <dc:creator>Tecla1</dc:creator>
      <dc:date>2022-12-13T12:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: "prxmatch" between two DB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849396#M335821</link>
      <description>&lt;P&gt;I really like the power of regular expressions but based on the sample data you've provided it doesn't look to me like regular expressions are required here (they are very resource intensive).&lt;/P&gt;
&lt;P&gt;You haven't shown us an expected result so not sure if you really want to search for words or just for strings.&lt;/P&gt;
&lt;P&gt;Have a look at below code. Does this return what you're after?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  length a b $30;
  a = 'emil, Nordpole, richard, Theo';
  b = 'something, somethingelse';
  output;
  a = 'sandman, emil, peter';
  b = 'whatever';
  output;
  a = 'samuel';
  b = 'anoterexample';
  output;
  a = 'stephany';
  b = 'lookingforwordshere';
  output;
run;

data list2;
  length word $30;
  word= 'nordpole';
  output;
  word= 'pet';
  output;
  word='lookingforwords';
  output;
run;

proc sql;
  select t1.*,t2.*
  from 
    have t1 left join list2 t2
      /* searching for terms */
      on findw(t1.a,t2.word,', ','itrsp')&amp;gt;0 or findw(t1.b,t2.word,', ','itrsp')&amp;gt;0
      /* searching for strings */
/*      on find(t1.a,t2.word,'it')&amp;gt;0 or find(t1.b,t2.word,'it')&amp;gt;0*/
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 13:12:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849396#M335821</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-12-13T13:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: "prxmatch" between two DB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849406#M335823</link>
      <description>Grazie!</description>
      <pubDate>Tue, 13 Dec 2022 13:04:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-prxmatch-quot-between-two-DB/m-p/849406#M335823</guid>
      <dc:creator>Tecla1</dc:creator>
      <dc:date>2022-12-13T13:04:44Z</dc:date>
    </item>
  </channel>
</rss>

