<?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' and 'Not Like' in a single statement in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677379#M23789</link>
    <description>&lt;P&gt;Just exchange %L A% and %LA%&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(city like '&lt;FONT color="#FF0000"&gt;%LA%&lt;/FONT&gt;' and city not like '%LAKE%' and city not like '%LAN%')&lt;BR /&gt;or city like '%COMPTO%' or city like '&lt;FONT color="#FF0000"&gt;%L A%&lt;/FONT&gt;' or city like '%LOS%'&lt;BR /&gt;or city like '%BEL%' or city like '%COM%' or city like '%LYN%' or city like '%GAT%'&lt;BR /&gt;or city like '%WALN%' or city like '%CUD%' or city like '%MAY%' or city like '%VERN%' or city like '%VARN%'&lt;BR /&gt;or city like '%HUNT%' or city like '%WILL%' or city like '%DOM%' or city like '%FLO%'&lt;/P&gt;</description>
    <pubDate>Tue, 18 Aug 2020 02:32:36 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-08-18T02:32:36Z</dc:date>
    <item>
      <title>'Like' and 'Not Like' in a single statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677368#M23785</link>
      <description>&lt;P&gt;I would like to include all the observations with %LA%, but I would like to avoid selecting %LAKE% and %LAND%. How can I do that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the following but it does not work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create want as &lt;BR /&gt;select *&amp;nbsp; from have&lt;BR /&gt;where &lt;BR /&gt;city like&amp;nbsp; '%L.A%' or city like '%LOS%' &lt;BR /&gt;and city not like '%LAKE%' and city not like '%LAN%'&amp;nbsp;&lt;BR /&gt;order by city;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 23:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677368#M23785</guid>
      <dc:creator>Barkat</dc:creator>
      <dc:date>2020-08-17T23:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: 'Like' and 'Not Like' in a single statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677371#M23786</link>
      <description>&lt;P&gt;Isn't this a matter of properly nesting the logical conditions?&amp;nbsp; Something &lt;EM&gt;&lt;STRONG&gt;like&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp; (put intended):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;where &lt;BR /&gt;(city like&amp;nbsp; '%L.A%'&amp;nbsp; and city not like '%LAKE%' and city not like '%LAN')
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;city like '%LOS%' &lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;BTW, you apparently typed (rather the cut and pasted) your code, since you had "create want" instead of "create table want".&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 00:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677371#M23786</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-08-18T00:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: 'Like' and 'Not Like' in a single statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677374#M23787</link>
      <description>Here I pasted the original statement. It is not working though&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;	create table bll_18_15ct as &lt;BR /&gt;	select *&lt;BR /&gt;	from bll_18&lt;BR /&gt;	where 	&lt;BR /&gt;		(city like  '%L.A%'  and city not like '%LAKE%' and city not like '%LAN%')or&lt;BR /&gt;		city like '%COMPTO%'	or	city like '%LA%' 	or	city like '%LOS%' &lt;BR /&gt;		or	city like '%BEL%'	or	city like '%COM%'	or	city like '%LYN%' 	or	city like '%GAT%' 	&lt;BR /&gt;		or	city like '%WALN%' 	or	city like '%CUD%' 	or	city like '%MAY%' 	or	city like '%VERN%' 	or	city like '%VARN%'&lt;BR /&gt;		or	city like '%HUNT%' 	or	city like '%WILL%' 	or	city like '%DOM%' 	or	city like '%FLO%' &lt;BR /&gt;	order by city;&lt;BR /&gt;quit;</description>
      <pubDate>Tue, 18 Aug 2020 00:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677374#M23787</guid>
      <dc:creator>Barkat</dc:creator>
      <dc:date>2020-08-18T00:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: 'Like' and 'Not Like' in a single statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677376#M23788</link>
      <description>&lt;P&gt;You apparently didn't consistently apply my comment&amp;nbsp; about nesting. You are using an extra or city like '%LA%' (in &lt;EM&gt;&lt;STRONG&gt;bold italics&lt;/STRONG&gt;&lt;/EM&gt; below)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(city like '%L.A%' and city not like '%LAKE%' and city not like '%LAN%')or&lt;BR /&gt;city like '%COMPTO%' &lt;EM&gt;&lt;STRONG&gt;or city like '%LA%'&lt;/STRONG&gt; &lt;/EM&gt;or city like '%LOS%'&lt;BR /&gt;or city like '%BEL%' or city like '%COM%' or city like '%LYN%' or city like '%GAT%'&lt;BR /&gt;or city like '%WALN%' or city like '%CUD%' or city like '%MAY%' or city like '%VERN%' or city like '%VARN%'&lt;BR /&gt;or city like '%HUNT%' or city like '%WILL%' or city like '%DOM%' or city like '%FLO%'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The condition totally defeats all&amp;nbsp; the "not like" conditions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a general programming issue - it isn't a programming problem unique to SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And BTW, "not working" is next to a useless description.&amp;nbsp; Let us know what you expected vs.what you actually produced.&amp;nbsp; Help us help you.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 01:22:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677376#M23788</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-08-18T01:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: 'Like' and 'Not Like' in a single statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677379#M23789</link>
      <description>&lt;P&gt;Just exchange %L A% and %LA%&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(city like '&lt;FONT color="#FF0000"&gt;%LA%&lt;/FONT&gt;' and city not like '%LAKE%' and city not like '%LAN%')&lt;BR /&gt;or city like '%COMPTO%' or city like '&lt;FONT color="#FF0000"&gt;%L A%&lt;/FONT&gt;' or city like '%LOS%'&lt;BR /&gt;or city like '%BEL%' or city like '%COM%' or city like '%LYN%' or city like '%GAT%'&lt;BR /&gt;or city like '%WALN%' or city like '%CUD%' or city like '%MAY%' or city like '%VERN%' or city like '%VARN%'&lt;BR /&gt;or city like '%HUNT%' or city like '%WILL%' or city like '%DOM%' or city like '%FLO%'&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 02:32:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677379#M23789</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-08-18T02:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: 'Like' and 'Not Like' in a single statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677441#M23790</link>
      <description>Use sub-query .&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create want as&lt;BR /&gt;select * from&lt;BR /&gt; (&lt;BR /&gt;select *  from have where city not like '%LAKE%' and city not like '%LAN%' &lt;BR /&gt;)&lt;BR /&gt;where city like  '%L.A%' or city like '%LOS%'&lt;BR /&gt;order by city;&lt;BR /&gt;quit;</description>
      <pubDate>Tue, 18 Aug 2020 11:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Like-and-Not-Like-in-a-single-statement/m-p/677441#M23790</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-08-18T11:48:32Z</dc:date>
    </item>
  </channel>
</rss>

