<?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 strings with special characters comparison in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/strings-with-special-characters-comparison/m-p/902369#M356610</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have an example data:&lt;/P&gt;&lt;P&gt;The column in data A includes special characters: AA*B, A**B, AB**, and here * can be anything, both letter and number.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column in data B without special character: AADB, ABBF, AB3D.&lt;/P&gt;&lt;P&gt;so in this example, since AADB satisfies AA*B, AB3D satisfies AB**, they will be reported.&lt;/P&gt;&lt;P&gt;I do not know how to deal with them in SAS, could anyone help me to figure this out?&lt;/P&gt;&lt;P&gt;Thanks a lot.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Nov 2023 17:29:04 GMT</pubDate>
    <dc:creator>glz</dc:creator>
    <dc:date>2023-11-09T17:29:04Z</dc:date>
    <item>
      <title>strings with special characters comparison</title>
      <link>https://communities.sas.com/t5/SAS-Programming/strings-with-special-characters-comparison/m-p/902369#M356610</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have an example data:&lt;/P&gt;&lt;P&gt;The column in data A includes special characters: AA*B, A**B, AB**, and here * can be anything, both letter and number.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column in data B without special character: AADB, ABBF, AB3D.&lt;/P&gt;&lt;P&gt;so in this example, since AADB satisfies AA*B, AB3D satisfies AB**, they will be reported.&lt;/P&gt;&lt;P&gt;I do not know how to deal with them in SAS, could anyone help me to figure this out?&lt;/P&gt;&lt;P&gt;Thanks a lot.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 17:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/strings-with-special-characters-comparison/m-p/902369#M356610</guid>
      <dc:creator>glz</dc:creator>
      <dc:date>2023-11-09T17:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: strings with special characters comparison</title>
      <link>https://communities.sas.com/t5/SAS-Programming/strings-with-special-characters-comparison/m-p/902371#M356611</link>
      <description>&lt;P&gt;Sounds a lot like what the LIKE operator can handle.&lt;/P&gt;
&lt;P&gt;You can use LIKE in SQL queries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the text literally has * to represent a single character you will want to convert those to _ which is what the LIKE operator uses to match a single character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table want as 
  select a.*,b.xxx
  from table1 A 
    left join table2 B
   on a.column like translate(b.column,'_','*')
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the values in the pattern can include actual _ characters you will need to first prefix those with an escape character.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   on a.column like translate(tranwrd(b.column,'_','^_),'_','*') escape '^'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you cannot find an escape character to use that cannot appear in the pattern string then you will need to escape those also.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   on a.column like translate(tranwrd(tranwrd(b.column,'^','^^'),'_','^_),'_','*') escape '^'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 17:47:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/strings-with-special-characters-comparison/m-p/902371#M356611</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-09T17:47:39Z</dc:date>
    </item>
  </channel>
</rss>

