<?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: A little help with a Where clause? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-a-Where-clause/m-p/296779#M62232</link>
    <description>&lt;P&gt;"Effecient" is sometimes subjective depending on your needs. With computers you often are trading of CPU cycles, memory, input/output use and code maintenance.&lt;/P&gt;
&lt;P&gt;If you are comparing with hundreds of values then likely a join may be a better approach. If you are using Like where the value you are looking for either starts with or is equal to the values you've shown then possibly other comparisons may be better.&lt;/P&gt;
&lt;P&gt;For instance if the real values are equal then In would likely be a better (code maitenance, easy of reading)&amp;nbsp;approach:&amp;nbsp; Value In ("12345" "34567"). Of if you know that the bit you are looking for always occurs in postions 3 to 7 in a string it might be faster (CPU cyles) to substring and then use the In operator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You know your data. If the value(s) do not appear with any pattern then perhaps Like is the best approach.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Sep 2016 16:22:14 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-09-06T16:22:14Z</dc:date>
    <item>
      <title>A little help with a Where clause?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-a-Where-clause/m-p/296247#M62004</link>
      <description>&lt;P&gt;Please see the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=nicholas.unisummary__7i nowd;
column
i_X _VAR_ _NOBS_ _MEAN_ _MIN_ _P1_ _P5_ _P10_
_Q1_ _MEDIAN_ _Q3_ _P90_ _P95_ _P99_ _MAX_ ;

where _VAR_ = "Ratio_1a" ;
where also i_X like "%21503%" ;
where also i_X like "%21305%" ;

run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The third Where clause is causing a problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the first two Where clauses brings up the expected total number of rows (6).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adding the third results in 0 hits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Should be twice the number of hits as using the first two (12).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suggestions greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nicholas Kormanik&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 21:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-a-Where-clause/m-p/296247#M62004</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2016-09-02T21:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: A little help with a Where clause?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-a-Where-clause/m-p/296250#M62005</link>
      <description>&lt;P&gt;That looks like an AND problem similar to: &amp;nbsp;if A like "%3%" AND A like "%Q%"&lt;/P&gt;
&lt;P&gt;You really are not going to get both bits true.&lt;/P&gt;
&lt;P&gt;Did you try anything like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; also i_X like &lt;SPAN class="token string"&gt;"%21503%"&lt;/SPAN&gt;&amp;nbsp; &lt;STRONG&gt;OR&amp;nbsp;&lt;/STRONG&gt; i_X like &lt;SPAN class="token string"&gt;"%21305%"&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 21:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-a-Where-clause/m-p/296250#M62005</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-02T21:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: A little help with a Where clause?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-a-Where-clause/m-p/296255#M62007</link>
      <description>&lt;P&gt;Thanks ballardw. &amp;nbsp;I thought it was an AND problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This as well as this, as well as this, too. &amp;nbsp;Not OR.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Plus I wasn't sure how exactly to set it up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After your change, is it now written in the most efficient way?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 23:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-a-Where-clause/m-p/296255#M62007</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2016-09-02T23:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: A little help with a Where clause?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-a-Where-clause/m-p/296779#M62232</link>
      <description>&lt;P&gt;"Effecient" is sometimes subjective depending on your needs. With computers you often are trading of CPU cycles, memory, input/output use and code maintenance.&lt;/P&gt;
&lt;P&gt;If you are comparing with hundreds of values then likely a join may be a better approach. If you are using Like where the value you are looking for either starts with or is equal to the values you've shown then possibly other comparisons may be better.&lt;/P&gt;
&lt;P&gt;For instance if the real values are equal then In would likely be a better (code maitenance, easy of reading)&amp;nbsp;approach:&amp;nbsp; Value In ("12345" "34567"). Of if you know that the bit you are looking for always occurs in postions 3 to 7 in a string it might be faster (CPU cyles) to substring and then use the In operator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You know your data. If the value(s) do not appear with any pattern then perhaps Like is the best approach.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2016 16:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-a-Where-clause/m-p/296779#M62232</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-06T16:22:14Z</dc:date>
    </item>
  </channel>
</rss>

