<?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: Doubt in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692293#M24892</link>
    <description>Why not make a dummy data to test them ?&lt;BR /&gt;WHERE could get faster if it is small data.&lt;BR /&gt;IF could get faster if it is big data.&lt;BR /&gt;</description>
    <pubDate>Sat, 17 Oct 2020 09:45:37 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2020-10-17T09:45:37Z</dc:date>
    <item>
      <title>Doubt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692181#M24883</link>
      <description>which statement is efficient between where and if statement??</description>
      <pubDate>Fri, 16 Oct 2020 17:21:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692181#M24883</guid>
      <dc:creator>Pooja98</dc:creator>
      <dc:date>2020-10-16T17:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Doubt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692189#M24885</link>
      <description>&lt;P&gt;Define "is efficient".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF statements can check conditions that WHERE can't. Variables used in a Where expression have to exist in a source data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WHERE can use some operations that IF can't. Where is usable in most procedure but IF isn't.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 17:33:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692189#M24885</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-16T17:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Doubt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692234#M24887</link>
      <description>&lt;P&gt;In addition to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;'s comment, there is another important difference between WHERE and IF - namely that where will outsource the filtering to the data engine, while if only filters once the data observation has been passed to the data step.&amp;nbsp; This data engine might be the sas engine for various types of sas datasets, or a database for which sas/access has an engine (see&amp;nbsp;&lt;A href="https://www.sas.com/en_us/software/access/access-engines1.html" target="_self"&gt;SAS/ACCESS Software Access Engines&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The fact that where-filtering is outsourced is not only why you can use where in your proc freq's, proc reg's, proc sort's, etc., but it also can make the where statement (compared to a subsetting if) a more efficient filter in a data step.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 20:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692234#M24887</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-10-16T20:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Doubt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692293#M24892</link>
      <description>Why not make a dummy data to test them ?&lt;BR /&gt;WHERE could get faster if it is small data.&lt;BR /&gt;IF could get faster if it is big data.&lt;BR /&gt;</description>
      <pubDate>Sat, 17 Oct 2020 09:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692293#M24892</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-10-17T09:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Doubt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692465#M24898</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/305675"&gt;@Pooja98&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;which statement is efficient between where and if statement??&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have to use where instead of subsetting-if, whenever you are using by-group-processing or end=somevar in the set statement. Execute the following steps and have a look at the log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data girls1;
   set sashelp.class end=lastObs;
   where Sex = 'F';
   if lastObs then put 'Just read ' _n_ 'obs.';
run;

data girls2;
   set sashelp.class end=lastObs;
   if Sex = 'F';
   if lastObs then put 'Just read ' _n_ 'obs.';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Oct 2020 09:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Doubt/m-p/692465#M24898</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-10-19T09:57:17Z</dc:date>
    </item>
  </channel>
</rss>

