<?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: Efficient use of Where statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232823#M42452</link>
    <description>&lt;P&gt;This syntax worked well.&amp;nbsp; Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 02 Nov 2015 22:20:26 GMT</pubDate>
    <dc:creator>jenim514</dc:creator>
    <dc:date>2015-11-02T22:20:26Z</dc:date>
    <item>
      <title>Efficient use of Where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232801#M42441</link>
      <description>&lt;P&gt;Im creating a table from a larger data set, and I know there must be a more efficient way to do this.&amp;nbsp; I need to select patients between the age of 2 and 13 with a diagnosis "493XX" in the DX1, DX2,DX3 or DX4 variable field.&amp;nbsp; Right now, I'm doing this in 2 tables-- 1st grabing the age group I need, and then in a seperate data step, searching the DX from that table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; need1_C1407;&lt;/P&gt;
&lt;P&gt;set have_ C1407;&lt;/P&gt;
&lt;P&gt;where Patage between &lt;STRONG&gt;2&lt;/STRONG&gt; and &lt;STRONG&gt;13&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; need_AD1407;&lt;/P&gt;
&lt;P&gt;set need1_C1407;&lt;/P&gt;
&lt;P&gt;where dx1 like '493%' or&lt;/P&gt;
&lt;P&gt;dx2 like '493%' or&lt;/P&gt;
&lt;P&gt;dx3 like '493%' or&lt;/P&gt;
&lt;P&gt;dx4 like '493;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried doing this in one step, but I keep getting an error.&amp;nbsp; Thanks!!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 20:19:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232801#M42441</guid>
      <dc:creator>jenim514</dc:creator>
      <dc:date>2015-11-02T20:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient use of Where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232805#M42444</link>
      <description>Post what you've tried that generates the error. &lt;BR /&gt;&lt;BR /&gt;You should be able to combine them with an AND and appropriate brackets.</description>
      <pubDate>Mon, 02 Nov 2015 20:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232805#M42444</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-11-02T20:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient use of Where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232814#M42449</link>
      <description>&lt;P&gt;"Like" is an SQL function, not datastep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you DX codes are character try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DX1 =: "493" or ...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The =: is "starts with"&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 21:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232814#M42449</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-11-02T21:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient use of Where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232815#M42450</link>
      <description>&lt;P&gt;In addition to Reeza's suggestion, the program would be slightly faster to switch from " like " to " =: ".&amp;nbsp; In combination, the result might look like this:&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;where (2 &amp;lt;= Patage &amp;lt;= 13)&lt;/P&gt;
&lt;P&gt;and (dx1 =: '493' or dx2 =: '493' or dx3 =: '493' or dx4 =: '493');&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Looks like great minds think alike, and perhaps at the same time!)&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 21:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232815#M42450</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-11-02T21:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient use of Where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232823#M42452</link>
      <description>&lt;P&gt;This syntax worked well.&amp;nbsp; Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 22:20:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-use-of-Where-statement/m-p/232823#M42452</guid>
      <dc:creator>jenim514</dc:creator>
      <dc:date>2015-11-02T22:20:26Z</dc:date>
    </item>
  </channel>
</rss>

