<?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: Why 2 identical SAS tables show a difference in values when using PROC COMPARE? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-2-identical-SAS-tables-show-a-difference-in-values-when/m-p/968111#M376502</link>
    <description>&lt;P&gt;Another option to account for numeric precision issues is to use the ROUND function on the variable (Price) in advance in each data set.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
set one;
price=round(price,.01);
run;

data two;
set two;
price=round(price,.01);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 04 Jun 2025 11:39:56 GMT</pubDate>
    <dc:creator>Kathryn_SAS</dc:creator>
    <dc:date>2025-06-04T11:39:56Z</dc:date>
    <item>
      <title>Why 2 identical SAS tables show a difference in values when using PROC COMPARE?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-2-identical-SAS-tables-show-a-difference-in-values-when/m-p/968091#M376500</link>
      <description>&lt;P&gt;I have two identical tables, WORK.ONE and WORK.TWO (this is only for simplicity). The code to create them and assign them indexes is the following:&lt;/P&gt;
&lt;PRE&gt;data work.one;
  length id $2 product $5 price 8;
  input id $ product $ price;
  datalines;
  A3 Desk 500
  A4 Table 1000
  B1 Bed 1500
  ;
run;

data work.two;
  length id $2 product $5 price 8;
  input id $ product $ price;
  datalines;
  A3 Desk 500
  A4 Table 1000
  B1 Bed 1500
  ;
run;

proc datasets lib=work;
  modify one;
  index create id;
run;

proc datasets lib=work;
  modify two;
  index create id;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to compare them using PROC COMPARE as follows:&lt;/P&gt;
&lt;PRE&gt;proc compare b=one c=two;
  id id;
run;&lt;/PRE&gt;
&lt;P&gt;I get the following results, again simplified:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Variables with Unequal Values&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Variable&amp;nbsp; &amp;nbsp;Type&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Len&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Ndif&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MaxDif&lt;/P&gt;
&lt;P&gt;price&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NUM&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3.5E-20&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Value Comparison Results for Variables&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;||&amp;nbsp; &amp;nbsp; Base&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Compare&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Diff.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %Diff&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;price&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;price&lt;/P&gt;
&lt;P&gt;-----------------------------------------------------------------------&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A4&amp;nbsp; &amp;nbsp; &amp;nbsp;||&amp;nbsp; 1000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1000&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.5E-20&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.3E-20&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Although the values are identical, they are not recognised like that. Obviously the difference tends to zero, but I need it to be shown as exactly equal. Do you have any idea of how I can fix this? Thanks a lot in advance.&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>Wed, 04 Jun 2025 11:06:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-2-identical-SAS-tables-show-a-difference-in-values-when/m-p/968091#M376500</guid>
      <dc:creator>mvalsamis</dc:creator>
      <dc:date>2025-06-04T11:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why 2 identical SAS tables show a difference in values when using PROC COMPARE?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-2-identical-SAS-tables-show-a-difference-in-values-when/m-p/968095#M376501</link>
      <description>&lt;P&gt;Clearly the difference is very small:&amp;nbsp;3.5E-20. Why does this happen? Because computers cannot represent some non-integer numbers with infinite precision, and so these will show as different. (I do not get the results you show from your code, indicating that your real-world data that you ran PROC COMPARE on did not have integers for PRICE)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To avoid this problem, use the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/proc/n0c1y14wyd3u7yn1dmfcpaejllsn.htm#p0fltyd84dayuan1nk8kph6pcdxe" target="_self"&gt;FUZZ=&lt;/A&gt; option in PROC COMPARE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 11:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-2-identical-SAS-tables-show-a-difference-in-values-when/m-p/968095#M376501</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-06-04T11:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Why 2 identical SAS tables show a difference in values when using PROC COMPARE?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-2-identical-SAS-tables-show-a-difference-in-values-when/m-p/968111#M376502</link>
      <description>&lt;P&gt;Another option to account for numeric precision issues is to use the ROUND function on the variable (Price) in advance in each data set.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
set one;
price=round(price,.01);
run;

data two;
set two;
price=round(price,.01);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jun 2025 11:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-2-identical-SAS-tables-show-a-difference-in-values-when/m-p/968111#M376502</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2025-06-04T11:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why 2 identical SAS tables show a difference in values when using PROC COMPARE?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-2-identical-SAS-tables-show-a-difference-in-values-when/m-p/968112#M376503</link>
      <description>&lt;P&gt;Yes, this example is oversimplified, and if you compare the two tables, they will be exactly identical. The actual tables I am working in have 24 numeric variables, which have decimals.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 11:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-2-identical-SAS-tables-show-a-difference-in-values-when/m-p/968112#M376503</guid>
      <dc:creator>mvalsamis</dc:creator>
      <dc:date>2025-06-04T11:41:10Z</dc:date>
    </item>
  </channel>
</rss>

