<?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 evaluate missing numeric value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IF-evaluate-missing-numeric-value/m-p/976849#M378394</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16608"&gt;@hellind&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Why does it return result=1 when I am expecting result=2?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A positive numeric value compared against a missing numeric value would return False.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why would you think that?&amp;nbsp; That is not what your example shows.&lt;/P&gt;
&lt;P&gt;It is also not what the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/p0ueqauvtyb2hqn1mj79t26azlxv.htm" target="_self"&gt;documentation&lt;/A&gt; says.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Within SAS, a missing value for a numeric variable is smaller than all numbers.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Perhaps you are thinking of some other system that implement TRI level logic where the result of a boolean expression could be TRUE or FALSE or unknown.&amp;nbsp; But SAS only used BINARY logic.&amp;nbsp; Any boolean expression is either TRUE or FALSE.&amp;nbsp; And to make that possible all missing values are less than all non-missing value.&amp;nbsp; And missing values are treated as equal to the same missing value.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Try this experiment to see how SAS orders numbers.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  do i=-1,0,1,.,._,.a,.b,.y,.z;
    output;
  end;
run;
proc sort data=test; 
  by i;
run;
proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Results:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;  Obs     i

   1      _
   2      .
   3      A
   4      B
   5      Y
   6      Z
   7     -1
   8      0
   9      1

&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Oct 2025 02:00:52 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2025-10-13T02:00:52Z</dc:date>
    <item>
      <title>IF evaluate missing numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-evaluate-missing-numeric-value/m-p/976847#M378392</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro misrewrite2( );
  
data rw_orig;
set rw1.rw&amp;amp;yymm.; 

day_new = 5;
cycle_new = .; 


if day_new gt cycle_new then result=1;
else result=2;


run;
  
%mend misrewrite2; 
%misrewrite2( );&lt;/PRE&gt;&lt;P&gt;Why does it return result=1 when I am expecting result=2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A positive numeric value compared against a missing numeric value would return False.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 01:14:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-evaluate-missing-numeric-value/m-p/976847#M378392</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2025-10-13T01:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: IF evaluate missing numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-evaluate-missing-numeric-value/m-p/976849#M378394</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16608"&gt;@hellind&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Why does it return result=1 when I am expecting result=2?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A positive numeric value compared against a missing numeric value would return False.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why would you think that?&amp;nbsp; That is not what your example shows.&lt;/P&gt;
&lt;P&gt;It is also not what the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/p0ueqauvtyb2hqn1mj79t26azlxv.htm" target="_self"&gt;documentation&lt;/A&gt; says.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Within SAS, a missing value for a numeric variable is smaller than all numbers.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Perhaps you are thinking of some other system that implement TRI level logic where the result of a boolean expression could be TRUE or FALSE or unknown.&amp;nbsp; But SAS only used BINARY logic.&amp;nbsp; Any boolean expression is either TRUE or FALSE.&amp;nbsp; And to make that possible all missing values are less than all non-missing value.&amp;nbsp; And missing values are treated as equal to the same missing value.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Try this experiment to see how SAS orders numbers.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  do i=-1,0,1,.,._,.a,.b,.y,.z;
    output;
  end;
run;
proc sort data=test; 
  by i;
run;
proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Results:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;  Obs     i

   1      _
   2      .
   3      A
   4      B
   5      Y
   6      Z
   7     -1
   8      0
   9      1

&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 02:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-evaluate-missing-numeric-value/m-p/976849#M378394</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-10-13T02:00:52Z</dc:date>
    </item>
  </channel>
</rss>

