<?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: like operand imprecision in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399592#M66651</link>
    <description>&lt;P&gt;If you're allowed to use a DATA step, the problem is trivial:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if var = : 'datal_' then delete;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Sep 2017 19:15:15 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-09-28T19:15:15Z</dc:date>
    <item>
      <title>like operand imprecision</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399568#M66646</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm trying to sort out certain instances of a character variable.&amp;nbsp; The data in the variable is in the form either:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data_1&lt;/P&gt;&lt;P&gt;dataI_1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The difference being the roman numeral "I' after data.&amp;nbsp; The numbers "1" can vary.&amp;nbsp; I want only data_, and to drop instances of dataI_.&amp;nbsp; Thus:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql; create table info&lt;/P&gt;&lt;P&gt;as select *&lt;/P&gt;&lt;P&gt;from data&lt;/P&gt;&lt;P&gt;where var like 'data_%'&lt;/P&gt;&lt;P&gt;;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Surprisingly, this does not drop instances of dataI_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone recommend a fix?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 17:50:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399568#M66646</guid>
      <dc:creator>tellmeaboutityo</dc:creator>
      <dc:date>2017-09-28T17:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: like operand imprecision</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399585#M66649</link>
      <description>&lt;P&gt;I suspect this won't work with your real data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data stuff;
   input myvar $20.;
datalines;
data_1
dataI_1
data_2
dataI_2
data)_1
;
run;


proc sql; 
	create table only_no_Is
	as select *
	from stuff
	where substr(myvar, 5, 1) not in ("I");
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Yeilds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;myvar
data_1
data_2
data)_1
&lt;/PRE&gt;
&lt;P&gt;prxmatch would probably be better. I would use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data no_Is;
	set stuff;
	if not prxmatch("m/I/",myvar);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Sep 2017 18:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399585#M66649</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2017-09-28T18:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: like operand imprecision</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399590#M66650</link>
      <description>&lt;P&gt;Underscore is a special character to the LIKE operator used to match any single character. So your query will match any string of five or more characters that start with 'date'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will need to escape it if you want LIKE to treat it as a literal underscore.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var like 'data^_%' escape '^'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 19:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399590#M66650</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-28T19:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: like operand imprecision</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399592#M66651</link>
      <description>&lt;P&gt;If you're allowed to use a DATA step, the problem is trivial:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if var = : 'datal_' then delete;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 19:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399592#M66651</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-09-28T19:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: like operand imprecision</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399642#M66656</link>
      <description>&lt;P&gt;IN the data step there is the '=:' operator, which first shortens the longer operand to lenght of the shorter, then compare for equality:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   where   var =: 'data_';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL does not support '=:' but it does have &lt;EM&gt;&lt;STRONG&gt;EQT&lt;/STRONG&gt;&lt;/EM&gt; (and &lt;EM&gt;&lt;STRONG&gt;GET&lt;/STRONG&gt;&lt;/EM&gt; and &lt;EM&gt;&lt;STRONG&gt;LET&lt;/STRONG&gt;&lt;/EM&gt;) "&lt;EM&gt;&lt;STRONG&gt;truncated string comparison operators&lt;/STRONG&gt;&lt;/EM&gt;":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  var='dataI_1';output;
  var='data_1'; output;
run;

proc sql;
  create table info2
  as select *
  from have
  where var EQT 'data_';
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Sep 2017 21:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399642#M66656</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-09-28T21:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: like operand imprecision</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399745#M66664</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't&amp;nbsp;have an answer for&amp;nbsp;the "like" issue, but the following works fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; info;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; LowCase(var) =: &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"data_"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 11:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/like-operand-imprecision/m-p/399745#M66664</guid>
      <dc:creator>RexDeus9</dc:creator>
      <dc:date>2017-09-29T11:46:02Z</dc:date>
    </item>
  </channel>
</rss>

