<?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: Do “subsetting if” and “where” clauses do the same thing? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92350#M26287</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No they don't.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the following paper for some examples/details:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://www.lexjansen.com/wuss/2005/sas_solutions/sol_where_vs_if_statements.pdf" title="http://www.lexjansen.com/wuss/2005/sas_solutions/sol_where_vs_if_statements.pdf"&gt;http://www.lexjansen.com/wuss/2005/sas_solutions/sol_where_vs_if_statements.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Aug 2012 19:35:00 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2012-08-13T19:35:00Z</dc:date>
    <item>
      <title>Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92349#M26286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Hi SAS Community,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;I have applied “subsetting if” and “where” clauses like below and they produced the same number of records in both table “want_1” and “want_2”.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1). Approach I - “subsetting if”&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; want_1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; bank_number = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;40&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;2). Approach II - “where”&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; want_2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Where bank_number = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;40&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG style="color: #008000;"&gt;Question &lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, SAS sometimes produce correct results for wrong reasons if we do not use it with full knowledge what is happening inside. This happened to me many times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, could any expert confirm me if the Approach I and II above produce same results always?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mirisage&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 19:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92349#M26286</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-08-13T19:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92350#M26287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No they don't.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the following paper for some examples/details:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://www.lexjansen.com/wuss/2005/sas_solutions/sol_where_vs_if_statements.pdf" title="http://www.lexjansen.com/wuss/2005/sas_solutions/sol_where_vs_if_statements.pdf"&gt;http://www.lexjansen.com/wuss/2005/sas_solutions/sol_where_vs_if_statements.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 19:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92350#M26287</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-08-13T19:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92351#M26288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if variable &lt;SPAN style="color: #ff0000;"&gt;bank_number &lt;SPAN style="color: #000000;"&gt;is already in dataset have then if and where would produce the same result.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if &lt;/SPAN&gt;variable &lt;SPAN style="color: #ff0000;"&gt;bank_number &lt;SPAN style="color: #000000;"&gt;is created in the same data step then only if works.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data class;&lt;BR /&gt;&amp;nbsp; set sashelp.class;&lt;BR /&gt;&amp;nbsp; if age &amp;lt;14 then group=1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else group=2;&lt;BR /&gt;&amp;nbsp; if group=1;/* you can't use "where" */&lt;BR /&gt;&amp;nbsp; proc print;run;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sex&amp;nbsp;&amp;nbsp;&amp;nbsp; Age&amp;nbsp;&amp;nbsp;&amp;nbsp; Height&amp;nbsp;&amp;nbsp;&amp;nbsp; Weight&amp;nbsp;&amp;nbsp;&amp;nbsp; group&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; Alice&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 56.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 84.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; Barbara&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65.3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 98.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; James&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; M&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 57.3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 83.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp; Jane&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 59.8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 84.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp; Jeffrey&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; M&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 62.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 84.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp; John&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; M&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 59.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 99.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; Joyce&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 51.3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp; Louise&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 56.3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 77.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; Robert&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; M&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 64.8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 128.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; Thomas&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; M&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 57.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 85.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 19:36:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92351#M26288</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-08-13T19:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92352#M26289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Someone will have to correct me if I'm wrong but, in the example you provided, I think that the two methods WILL always produce the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And, the paper that Fareeza referenced and example that Linlin gave, the paper and example didn't take into account the where data step option.&amp;nbsp; e.g.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data class (where=(group eq 1));&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if age &amp;lt;14 then group=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else group=2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 19:51:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92352#M26289</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-13T19:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92353#M26290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And also a where in a data step that has a merge doesn't always do what I think it should sometimes. &lt;/P&gt;&lt;P&gt;The overall answer to your question is 'it depends on the situation'. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 20:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92353#M26290</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-08-13T20:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92354#M26291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your examples, you get the same result as long as BANK_NUMBER already exists in your incoming data set, and as long as it is defined as being numeric.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is really that you may add features to your DATA step without really understanding how the results could suddenly become different.&amp;nbsp; For example, here are two common situations.&amp;nbsp; If you add END= on the SET statement, or if you add a BY statement, the results could very easily be different.&amp;nbsp; While you are relatively safe for this particular example that you posted, those simple changes will suddenly produce different results.&amp;nbsp; Moreover, you may not even notice that the results would be different because they might depend on the data.&amp;nbsp; For some versions of HAVE, adding END= or BY still produces identical results.&amp;nbsp; For other versions of HAVE, the results could be different.&amp;nbsp; There is no substitute for understanding how IF and WHERE work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 21:34:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92354#M26291</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-08-13T21:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92355#M26292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The "where" clause is applied in the data engine.&amp;nbsp; Think of it as being applied BEFORE the data step sees the data - so cases that don't qualify are never in the PDV, which is why this won't work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; hw=height*weight;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where hw&amp;gt;0;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But an "if hw&amp;gt;0" would work.&amp;nbsp; It doesn't get invoked until data is in the PDV.&amp;nbsp; This understanding also help to explain the impact on options like FIRSTOBS and OBS in the presence of WHERE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 22:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92355#M26292</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2012-08-13T22:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92356#M26293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more thing, WHERE is always faster than IF .not only it pick up obs before obs enter PDV (not like IF,it is after obs enter PDV) ,but also WHERE can use INDEX for you .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 04:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92356#M26293</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-08-14T04:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92357#M26294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quote from Keshan: 'WHERE is always faster than IF'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOT always, especially when dealing huge data set. In my line of work (Part D claim data), multimillion level of records is the routine. Depending on the data retrieval rate, I found 'if' is faster than 'where' in many cases, sometimes a lot faster if the rate is a bit extreme. 'where' bears an edge when the retrieval rate is less than 2-3%. (sounds familiar? reminding me of&amp;nbsp; index)&lt;/P&gt;&lt;P&gt;Here is a example (95% data retrieval), please note, when data structure is more complicated (more variables, more variable types and length), the difference tends to be larger:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;40&amp;nbsp;&amp;nbsp; DATA test;&lt;/P&gt;&lt;P&gt;41&amp;nbsp;&amp;nbsp; do i=1 to 100000000;&lt;/P&gt;&lt;P&gt;42&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;43&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;44&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.TEST has 100000000 observations and 1 variables.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.95 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5.29 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;45&lt;/P&gt;&lt;P&gt;46&amp;nbsp;&amp;nbsp; data h1;&lt;/P&gt;&lt;P&gt;47&amp;nbsp;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;48&amp;nbsp;&amp;nbsp; where i&amp;gt;5000000;&lt;/P&gt;&lt;P&gt;49&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: There were 95000000 observations read from the data set WORK.TEST.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE i&amp;gt;5000000;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.H1 has 95000000 observations and 1 variables.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20.37 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16.98 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;50&lt;/P&gt;&lt;P&gt;51&amp;nbsp;&amp;nbsp; data h2;&lt;/P&gt;&lt;P&gt;52&amp;nbsp;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;53&amp;nbsp;&amp;nbsp; if i&amp;gt;5000000;&lt;/P&gt;&lt;P&gt;54&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: There were 100000000 observations read from the data set WORK.TEST.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.H2 has 95000000 observations and 1 variables.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11.82 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10.20 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 20:10:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92357#M26294</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-08-14T20:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92358#M26295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;haikuo: I get similar results with just 1,000,000 records (i.e., if being faster than where) .. even with a one variable indexed file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 20:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92358#M26295</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-14T20:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92359#M26296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, Art, I agree. Difference gets obvious when large data set involved. In general, it is a matter of personal preference, while I tremendously prefer 'if'. My major reason is that 'if' makes my life a lot easier, for 'if' can be used with '_n_', last-first.variable and 'by' statement, while 'where' can't. To me, the only case I use 'where' (besides procs of course) is that I have to use 'like' operator, which is really rare.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 21:17:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92359#M26296</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-08-14T21:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92360#M26297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The two code examples you provide should give identical results, though WHERE may be faster to run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However there are many cases where WHERE and subsetting IF do not give identical output. Compare:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;length x $5;&lt;/P&gt;&lt;P&gt;input x;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;One&lt;/P&gt;&lt;P&gt;Two&lt;/P&gt;&lt;P&gt;Three&lt;/P&gt;&lt;P&gt;Four&lt;/P&gt;&lt;P&gt;Five&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data subset_if;&lt;/P&gt;&lt;P&gt;set test;&lt;/P&gt;&lt;P&gt;sequence_number=_n_;&lt;/P&gt;&lt;P&gt;previous_x=lag(x);&lt;/P&gt;&lt;P&gt;if not(x="Three");&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data subset_where;&lt;/P&gt;&lt;P&gt;set test;&lt;/P&gt;&lt;P&gt;sequence_number=_n_;&lt;/P&gt;&lt;P&gt;previous_x=lag(x);&lt;/P&gt;&lt;P&gt;where not(x="Three");&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In creating SUBSET_IF, we read in and process all lines from TEST before dropping the third observation. Even though the third observation isn't output directly, it still affects what is output: sequence_number goes 1,2,4,5 and previous_x goes " ", "One", "Three", "Four".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In creating SUBSET_WHERE, the observation with x="Three" is deleted at an earlier stage, and there's no sign in the output that it ever existed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 01:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92360#M26297</guid>
      <dc:creator>GeoffreyBrent</dc:creator>
      <dc:date>2012-08-15T01:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Do “subsetting if” and “where” clauses do the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92361#M26298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank everyone of you for your time and expertise.&lt;/P&gt;&lt;P&gt;This generated a tremondous knowledge base on the subject.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Mirisage&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 18:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-subsetting-if-and-where-clauses-do-the-same-thing/m-p/92361#M26298</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-08-15T18:55:40Z</dc:date>
    </item>
  </channel>
</rss>

