<?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: IF (in data step) versus WHERE (in PROC) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/IF-in-data-step-versus-WHERE-in-PROC/m-p/276171#M58632</link>
    <description>&lt;P&gt;The DATA step code is actually compiled, and not just run from a precompiled module as in PROC steps.&lt;/P&gt;
&lt;P&gt;Therefore the SAS datastep compiler can recognize variable type inconsistencies and compile a typecast into the code. This is what causes the NOTE: messages about type conversion in the log.&lt;/P&gt;
&lt;P&gt;This is, of course, not possible for dataset options (the where condition in the PROC is working like a dataset option) that don't have the luxury of compilation.&lt;/P&gt;
&lt;P&gt;So you won't get around the character-to-numeric conversion, be it explicit or implicit.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jun 2016 07:57:27 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-06-09T07:57:27Z</dc:date>
    <item>
      <title>IF (in data step) versus WHERE (in PROC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/IF-in-data-step-versus-WHERE-in-PROC/m-p/276169#M58631</link>
      <description>&lt;P&gt;&lt;EM&gt;blah&lt;/EM&gt; is a character variable mostly populated with numbers in dataset &lt;EM&gt;fred&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if I do this ...&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; data fred2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set fred;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if sum(blah) ^= .;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;... SAS will give me just those records which don't have just numbers in &lt;EM&gt;blah&lt;/EM&gt;.&lt;BR /&gt;&lt;BR /&gt;However, if I try something like this ...&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; proc tabulate data=fred;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where sum(blah) ^=.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&lt;BR /&gt;... SAS complains with the error:&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;ERROR: Function SUM requires a numeric expression as argument 1.&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;Is there any way I can avoid that additional data step above and still filter on &lt;EM&gt;sum(blah) ^=.&lt;/EM&gt; directly in the PROC?&lt;STRONG&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 07:34:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/IF-in-data-step-versus-WHERE-in-PROC/m-p/276169#M58631</guid>
      <dc:creator>fred777</dc:creator>
      <dc:date>2016-06-09T07:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: IF (in data step) versus WHERE (in PROC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/IF-in-data-step-versus-WHERE-in-PROC/m-p/276171#M58632</link>
      <description>&lt;P&gt;The DATA step code is actually compiled, and not just run from a precompiled module as in PROC steps.&lt;/P&gt;
&lt;P&gt;Therefore the SAS datastep compiler can recognize variable type inconsistencies and compile a typecast into the code. This is what causes the NOTE: messages about type conversion in the log.&lt;/P&gt;
&lt;P&gt;This is, of course, not possible for dataset options (the where condition in the PROC is working like a dataset option) that don't have the luxury of compilation.&lt;/P&gt;
&lt;P&gt;So you won't get around the character-to-numeric conversion, be it explicit or implicit.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 07:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/IF-in-data-step-versus-WHERE-in-PROC/m-p/276171#M58632</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-06-09T07:57:27Z</dc:date>
    </item>
  </channel>
</rss>

