<?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: SAS data step same operation with different results in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968899#M376677</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked into this a bit further and it appears that be behavior I observed is unique to SAS 9.4_M6 (as others already commented that they can't replicate on other version).&amp;nbsp; I rerun the same code on with 9.4_M7 and I got the expected behavior (the difference is 0).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More specifically, in 9.4_M6, I have this behavior (I promise this is a different screenshot from before, I just rerun the thing again):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_0-1749749201180.png" style="width: 643px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107787i9227C94B6692B247/image-dimensions/643x127?v=v2" width="643" height="127" role="button" title="FoxHope_0-1749749201180.png" alt="FoxHope_0-1749749201180.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same code with 9.4_M7:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_1-1749749264088.png" style="width: 643px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107788i4C781ADCF2FA5610/image-dimensions/643x127?v=v2" width="643" height="127" role="button" title="FoxHope_1-1749749264088.png" alt="FoxHope_1-1749749264088.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jun 2025 17:32:41 GMT</pubDate>
    <dc:creator>FoxHope</dc:creator>
    <dc:date>2025-06-12T17:32:41Z</dc:date>
    <item>
      <title>SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968869#M376657</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I came across an interesting behavior in the SAS data step. Essentially, two identical calculations have different results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt; data indata;
  a = 3;

  m = 1/a;
  n = 1/a;
 
  x = m-n;
  y = m-n;
run;
 
proc print data=indata;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The results are below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="twedwards_1-1749742357177.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107780iC4EA39DC287B2B1E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="twedwards_1-1749742357177.png" alt="twedwards_1-1749742357177.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As you can see, X and Y are different, despite both being set to the same operation of (m-n). I understand that there are issues with floating point values in programming where a subtraction of two identical fractions may not result in 0. My confusion is why x and y are not either both 0 or both the value of -1.8513E-17.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&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>Thu, 12 Jun 2025 15:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968869#M376657</guid>
      <dc:creator>twedwards</dc:creator>
      <dc:date>2025-06-12T15:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968875#M376661</link>
      <description>&lt;P&gt;Are you sure you printed the same dataset as made by that code?&lt;/P&gt;
&lt;PRE&gt;1    data indata;
2      a = 3;
3
4      m = 1/a;
5      n = 1/a;
6
7      x = m-n;
8      y = m-n;
9    run;

NOTE: The data set WORK.INDATA has 1 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


10
11   proc print data=indata;
12   run;

NOTE: There were 1 observations read from the data set WORK.INDATA.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1749744289286.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107781i57D9A2F3FCA20075/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1749744289286.png" alt="Tom_0-1749744289286.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 16:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968875#M376661</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-06-12T16:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968878#M376662</link>
      <description>&lt;P&gt;Yes. I just re-ran in a fresh session. I added two additional 'flags' to check equality.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt; data indata;
  a = 3;

  m = 1/a;
  n = 1/a;
 
  x = m-n;
  y = m-n;

  if m=n then FLAG1="Y";
  if x=y then FLAG2="Y";
run;
 
proc print data=indata;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="twedwards_0-1749744646438.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107782iC6C647A3DF41C3EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="twedwards_0-1749744646438.png" alt="twedwards_0-1749744646438.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What SAS version are you running? A coworker ran the above code on SAS EG as well, and observed similar results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 16:12:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968878#M376662</guid>
      <dc:creator>twedwards</dc:creator>
      <dc:date>2025-06-12T16:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968881#M376664</link>
      <description>&lt;P&gt;Hi Tom,&lt;BR /&gt;&lt;BR /&gt;I reran the same code and got the result that the OP had.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_0-1749744764320.png" style="width: 927px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107783i711B38703D5B6F5F/image-dimensions/927x205?v=v2" width="927" height="205" role="button" title="FoxHope_0-1749744764320.png" alt="FoxHope_0-1749744764320.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I insert the "put" command in between, suddenly both are 0 again. But outputting the values to log shouldn't change the calculation, should it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_1-1749744894412.png" style="width: 937px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107784i56B797FAE448C42D/image-dimensions/937x239?v=v2" width="937" height="239" role="button" title="FoxHope_1-1749744894412.png" alt="FoxHope_1-1749744894412.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 16:15:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968881#M376664</guid>
      <dc:creator>FoxHope</dc:creator>
      <dc:date>2025-06-12T16:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968882#M376665</link>
      <description>&lt;P&gt;This is classic &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/p0dv87zb3bnse6n1mqo360be70qr.htm" target="_self"&gt;numeric precision&lt;/A&gt; in SAS. We recommend using the ROUND function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data indata;
  a = 3;

  m = 1/a;
  n = 1/a;
 
  x = round(m-n,.01);
  y = round(m-n,.01);

  if m=n then FLAG1="Y";
  if x=y then FLAG2="Y";
run;
 
proc print data=indata;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jun 2025 16:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968882#M376665</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2025-06-12T16:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968884#M376667</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you mind if I ask further clarification question? Because it seems that this goes beyond the precision issue. If 1/3 cannot be represented precisely in binary, shouldn't the value of c and d be BOTH off by the same amount and their difference should be zero regardless?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried rerun the code and it seems that simply outputting the results to the log using put (as seen on my post above) would change the result of r and s. This seems too unintuitive for me to be explain by the numeric precision issue.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 16:26:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968884#M376667</guid>
      <dc:creator>FoxHope</dc:creator>
      <dc:date>2025-06-12T16:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968885#M376668</link>
      <description>&lt;P&gt;I can't replicate your results.&amp;nbsp; I ran on 9.4M7 (Windows) and 9.4M8 (Linux).&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 16:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968885#M376668</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-06-12T16:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968887#M376669</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/475762"&gt;@FoxHope&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you mind if I ask further clarification question? Because it seems that this goes beyond the precision issue. If 1/3 cannot be represented precisely in binary, shouldn't the value of c and d be BOTH off by the same amount and their difference should be zero regardless?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Agree, what you are reporting doesn't make sense to me, and isn't the basic numeric precision issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even if somehow these two statements could return different values (because of what, random noise in precision):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  m = 1/a;
  n = 1/a;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I can't think of an explanation for how these two statements could return different values (accept again random noise in precision...)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  x = m-n;
  y = m-n;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And yes, your addition of a PUT statement shouldn't change values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something odd is happening.&amp;nbsp; Did you quit SAS and restart a fresh session?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 16:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968887#M376669</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-06-12T16:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968890#M376670</link>
      <description>&lt;P&gt;Hi Quentin,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for testing on your machine! It appears I have a different version.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="twedwards_1-1749746225914.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107786i40CDE16B53FF0380/image-size/medium?v=v2&amp;amp;px=400" role="button" title="twedwards_1-1749746225914.png" alt="twedwards_1-1749746225914.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 16:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968890#M376670</guid>
      <dc:creator>twedwards</dc:creator>
      <dc:date>2025-06-12T16:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968891#M376671</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;After running proc product_status, it seems that my version is 9.4_M6 with image version 9.04.01M6P110718</description>
      <pubDate>Thu, 12 Jun 2025 16:37:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968891#M376671</guid>
      <dc:creator>FoxHope</dc:creator>
      <dc:date>2025-06-12T16:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968892#M376672</link>
      <description>&lt;P&gt;Hi Quentin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, I did restart my computer (just in case), restart the session, tried in both SAS 9.4 and SAS EG, I still have the same result that I posted earlier. I wonder if it's because I am running on a slightly older version of SAS (9.4_M6) since other people can't replicate what I see (except OP since we are having the same results).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 16:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968892#M376672</guid>
      <dc:creator>FoxHope</dc:creator>
      <dc:date>2025-06-12T16:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968893#M376673</link>
      <description>&lt;P&gt;You might try submitting to tech support.&amp;nbsp; I can't think of an explanation. It's interesting that you both have the same version (9.4M6) showing this odd behavior.&amp;nbsp; But I still have a hard time believing this is a weird bug.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 16:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968893#M376673</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-06-12T16:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968894#M376674</link>
      <description>&lt;P&gt;Here is another example that may help clarify the numeric precision issue. Note that both X and Y appear to be 1 but they are slightly different when viewed in hex.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;132  data test;
133  x=1;
134  y=1/10;
135
136  do i=1 to 9;
137    x+1;
138    y + 1/10;
139    end;
140  x=x/10;
141
142  put x hex16.;
143  put y hex16.;
144  run;

3FF0000000000000
3FEFFFFFFFFFFFFF
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Whenever the numeric variable is manipulated with an arithmetic function, the manipulation is done in binary. In other words, the floating point number is manipulated in binary and the result we see is the decimal form of the manipulation. SAS does not convert the number to decimal form, and&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;then perform the manipulation in decimal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Therefore, no matter what SAS step you use, PROC SQL, DATA Step or any other procedure, there is a chance that the binary mathematics will not result in the decimal mathematics.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason that SAS uses floating point representation is because this representation of numerics is what the operating system can easily manipulate. Using floating point allows the operating system to manipulate the bytes SAS stores without the need to convert those bytes to a binary form. This saves a significant amount of processing time. Additionally, using floating point&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;representation, SAS can store numbers with larger magnitude and greater precision with less bytes than if we used a decimal representation.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 17:02:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968894#M376674</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2025-06-12T17:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968895#M376675</link>
      <description>&lt;P&gt;That makes sense as the usual numeric precision issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I don't see how that could explain:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  a = 3;

  m = 1/a;
  n = 1/a;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Assigning different values to M and N.&amp;nbsp; Can it?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 17:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968895#M376675</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-06-12T17:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968899#M376677</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked into this a bit further and it appears that be behavior I observed is unique to SAS 9.4_M6 (as others already commented that they can't replicate on other version).&amp;nbsp; I rerun the same code on with 9.4_M7 and I got the expected behavior (the difference is 0).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More specifically, in 9.4_M6, I have this behavior (I promise this is a different screenshot from before, I just rerun the thing again):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_0-1749749201180.png" style="width: 643px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107787i9227C94B6692B247/image-dimensions/643x127?v=v2" width="643" height="127" role="button" title="FoxHope_0-1749749201180.png" alt="FoxHope_0-1749749201180.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same code with 9.4_M7:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_1-1749749264088.png" style="width: 643px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107788i4C781ADCF2FA5610/image-dimensions/643x127?v=v2" width="643" height="127" role="button" title="FoxHope_1-1749749264088.png" alt="FoxHope_1-1749749264088.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 17:32:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968899#M376677</guid>
      <dc:creator>FoxHope</dc:creator>
      <dc:date>2025-06-12T17:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968901#M376679</link>
      <description>&lt;P&gt;For what little it may mean, I get the expected appearance of 0 for both X and Y using SAS 9.4m4.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 18:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968901#M376679</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-06-12T18:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968903#M376681</link>
      <description>&lt;P&gt;Please send the code and those images of 9.4M6 and 9.4M7 in to tech support.&amp;nbsp; Maybe they can explain and document this bug (assuming they agree it's a bug...)&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 18:23:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968903#M376681</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-06-12T18:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968904#M376682</link>
      <description>&lt;P&gt;Just for fun, what happens in M6 if you do:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  r = m-n;
  s = m-n;
  t = m-n;
  u = m-n;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and what about:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  *  r = m-n;
  s = m-n;
  t = m-n;
  u = m-n;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And adding that PUT statement fixes the problem in M6?&amp;nbsp; That's a crazy part of the puzzle.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 18:27:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968904#M376682</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-06-12T18:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968919#M376686</link>
      <description>&lt;P&gt;I will consider sending a ticket to support later today. Seeing others not being able to replicate these results is making me doubt my own sanity lol. But otherwise, for funsies, happy to oblige with some experiments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;More subtractions:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_0-1749753235226.png" style="width: 520px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107789iCA4DAE2DBAAAFABA/image-dimensions/520x211?v=v2" width="520" height="211" role="button" title="FoxHope_0-1749753235226.png" alt="FoxHope_0-1749753235226.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Remove r = m-n&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_1-1749753275062.png" style="width: 518px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107790i8CD664C68D928940/image-dimensions/518x209?v=v2" width="518" height="209" role="button" title="FoxHope_1-1749753275062.png" alt="FoxHope_1-1749753275062.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Replace value of n to 1/3 from 1/a&lt;/STRONG&gt; (notice the sign change for r). This makes me thing that assigning a = 3 has some thing to do with this.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_2-1749753427297.png" style="width: 527px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107791i474CE940CE5B3E9C/image-dimensions/527x187?v=v2" width="527" height="187" role="button" title="FoxHope_2-1749753427297.png" alt="FoxHope_2-1749753427297.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lastly, &lt;STRONG&gt;outputting the values to log&lt;/STRONG&gt; does fix the problem only if the values were written to log before r is calculated.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_5-1749754292374.png" style="width: 811px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107794i25A7080EF1AAAB79/image-dimensions/811x301?v=v2" width="811" height="301" role="button" title="FoxHope_5-1749754292374.png" alt="FoxHope_5-1749754292374.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_6-1749754326960.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107795i6F0907063F427A8A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FoxHope_6-1749754326960.png" alt="FoxHope_6-1749754326960.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Same thing but different order&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_7-1749754401100.png" style="width: 755px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107796i969BB8C77D0685F2/image-dimensions/755x263?v=v2" width="755" height="263" role="button" title="FoxHope_7-1749754401100.png" alt="FoxHope_7-1749754401100.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FoxHope_8-1749754420028.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107797i0B6145E10049488C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FoxHope_8-1749754420028.png" alt="FoxHope_8-1749754420028.png" /&gt;&lt;/span&gt;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 18:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968919#M376686</guid>
      <dc:creator>FoxHope</dc:creator>
      <dc:date>2025-06-12T18:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step same operation with different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968921#M376687</link>
      <description>&lt;P&gt;I am in Technical Support. I am sorry I led you down the path of numeric precision when that isn't exactly the issue here. I am running the exact same version of 9.4M6 as you:&lt;/P&gt;
&lt;P&gt;13 %put &amp;amp;sysvlong;&lt;BR /&gt;9.04.01M6P110718&lt;/P&gt;
&lt;P&gt;and I am not replicating the same difference that you show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While the behavior does seem strange and incorrect, the fact that we cannot replicate it in the same version and the fact that it does not appear to occur in later releases suggests that it would not be treated as a bug for M6. Ultimately, the way to account for the difference when using imprecise values is to use the ROUND function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you are running on Windows 32-bit, the following SAS Note might provide some additional explanation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/techsup/notes/v8/6/214.html" target="_blank"&gt;6214 - Similar equations yield different results on Intel machines&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you would like to continue to pursue this through a case with &lt;A href="https://support.sas.com/en/technical-support.html" target="_self"&gt;Technical Support&lt;/A&gt;, please feel free to open a new one and include your complete log and output.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 18:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-data-step-same-operation-with-different-results/m-p/968921#M376687</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2025-06-12T18:57:08Z</dc:date>
    </item>
  </channel>
</rss>

