<?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 A question in SAS/SQL, please help. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-question-in-SAS-SQL-please-help/m-p/96187#M20270</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table Raisin as&lt;/P&gt;&lt;P&gt;select distinct 'Total' as Item, '' as Type, count(GFTAmt) as Count, sum(GFTAmt) format 12.2 as Amt&lt;/P&gt;&lt;P&gt;from A&lt;/P&gt;&lt;P&gt;union all&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;union all&lt;/P&gt;&lt;P&gt;select distinct 'EventType', EventType,&amp;nbsp; count(GFTAmt) , sum(GFTAmt)&lt;/P&gt;&lt;P&gt;from A&lt;/P&gt;&lt;P&gt;group by EventType&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table CRM is created in same way. When I run the following code, error comes.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;code 1.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;proc compare base=crm compare=Raisin out=result outnoequal outbase outcomp outdif ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var Count Amt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; title 'Comparison of Variables in Different Data Sets';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; id Item Type;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;----------The output1 shows:---------------------v&lt;/P&gt;&lt;P&gt;Comparison of Variables in Different Data Sets 14:20 Monday, April 26, 2012 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The COMPARE Procedure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Comparison of WORK.CRM with WORK.RAISIN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Method=EXACT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Values Comparison Summary&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Number of Variables Compared with All Observations Equal: 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Number of Variables Compared with Some Observations Unequal: 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Total Number of Values which Compare Unequal: 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maximum Difference: 2.2737E-13.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variables with Unequal Values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable Type Len Ndif MaxDif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amt NUM 8 1 227E-15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Value Comparison Results for Variables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__________________________________________________________________________________&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;|| Base Compare&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Item Type || Amt Amt Diff. % Diff&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________ __________________ || _________ _________ _________ _________&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;||&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EventType General || 1354.11 1354.11 2.274E-13 1.679E-14&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__________________________________________________________________________________&lt;/P&gt;&lt;H3 class="groups title"&gt;code2:&lt;/H3&gt;&lt;P class="groups title"&gt;proc sql; &lt;BR /&gt;select a.Item, a.type, a.count-b.count as count, &lt;BR /&gt;a.Amt ,b.Amt, a.Amt-b.Amt as AmtDiff &lt;BR /&gt;from raisin a, crm b &lt;BR /&gt;where a.Item=b.Item and a.type=b.type; &lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------Amt format 12.2 and here is a part of the output2----------------------------v&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Item Type count Amt Amt AmtDiff &lt;BR /&gt;... &lt;BR /&gt;EventType General 0 1354.11 1354.11 2.27E-13 &lt;BR /&gt;...&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------^&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is that how 2.27E-13 comes?:smileyconfused: how to avoid this format happens?&lt;/P&gt;&lt;P&gt;Please help. Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Apr 2012 18:44:46 GMT</pubDate>
    <dc:creator>Anne</dc:creator>
    <dc:date>2012-04-26T18:44:46Z</dc:date>
    <item>
      <title>A question in SAS/SQL, please help.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-in-SAS-SQL-please-help/m-p/96187#M20270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table Raisin as&lt;/P&gt;&lt;P&gt;select distinct 'Total' as Item, '' as Type, count(GFTAmt) as Count, sum(GFTAmt) format 12.2 as Amt&lt;/P&gt;&lt;P&gt;from A&lt;/P&gt;&lt;P&gt;union all&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;union all&lt;/P&gt;&lt;P&gt;select distinct 'EventType', EventType,&amp;nbsp; count(GFTAmt) , sum(GFTAmt)&lt;/P&gt;&lt;P&gt;from A&lt;/P&gt;&lt;P&gt;group by EventType&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table CRM is created in same way. When I run the following code, error comes.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;code 1.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;proc compare base=crm compare=Raisin out=result outnoequal outbase outcomp outdif ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var Count Amt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; title 'Comparison of Variables in Different Data Sets';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; id Item Type;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;----------The output1 shows:---------------------v&lt;/P&gt;&lt;P&gt;Comparison of Variables in Different Data Sets 14:20 Monday, April 26, 2012 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The COMPARE Procedure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Comparison of WORK.CRM with WORK.RAISIN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Method=EXACT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Values Comparison Summary&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Number of Variables Compared with All Observations Equal: 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Number of Variables Compared with Some Observations Unequal: 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Total Number of Values which Compare Unequal: 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maximum Difference: 2.2737E-13.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variables with Unequal Values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable Type Len Ndif MaxDif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amt NUM 8 1 227E-15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Value Comparison Results for Variables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__________________________________________________________________________________&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;|| Base Compare&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Item Type || Amt Amt Diff. % Diff&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________ __________________ || _________ _________ _________ _________&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;||&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EventType General || 1354.11 1354.11 2.274E-13 1.679E-14&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__________________________________________________________________________________&lt;/P&gt;&lt;H3 class="groups title"&gt;code2:&lt;/H3&gt;&lt;P class="groups title"&gt;proc sql; &lt;BR /&gt;select a.Item, a.type, a.count-b.count as count, &lt;BR /&gt;a.Amt ,b.Amt, a.Amt-b.Amt as AmtDiff &lt;BR /&gt;from raisin a, crm b &lt;BR /&gt;where a.Item=b.Item and a.type=b.type; &lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------Amt format 12.2 and here is a part of the output2----------------------------v&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Item Type count Amt Amt AmtDiff &lt;BR /&gt;... &lt;BR /&gt;EventType General 0 1354.11 1354.11 2.27E-13 &lt;BR /&gt;...&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------^&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is that how 2.27E-13 comes?:smileyconfused: how to avoid this format happens?&lt;/P&gt;&lt;P&gt;Please help. Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2012 18:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-in-SAS-SQL-please-help/m-p/96187#M20270</guid>
      <dc:creator>Anne</dc:creator>
      <dc:date>2012-04-26T18:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: A question in SAS/SQL, please help.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-in-SAS-SQL-please-help/m-p/96188#M20271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anne, formats only affect the printed representation of numbers, not their internal value. If, as it seems, the variable GFTamt should have only 2 decimals, you can avoid small errors due to floating point numbers representation by doing your own rounding. Replace sum(GFTamt) by round(sum(GFTamt), 0.01).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2012 20:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-in-SAS-SQL-please-help/m-p/96188#M20271</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-04-26T20:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: A question in SAS/SQL, please help.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-in-SAS-SQL-please-help/m-p/96189#M20272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you PG, I replaced sum() with round(sum()) and it works well. Thank you so much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 15:47:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-in-SAS-SQL-please-help/m-p/96189#M20272</guid>
      <dc:creator>Anne</dc:creator>
      <dc:date>2012-05-04T15:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: A question in SAS/SQL, please help.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-in-SAS-SQL-please-help/m-p/96190#M20273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Proc compare also has an OPTION FUZZ so you can set a small value where things are considered "close enough".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I deal with this often and use FUZZ= 1e-8 as the significant digits don't reach anywhere near that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 18:19:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-in-SAS-SQL-please-help/m-p/96190#M20273</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-05-04T18:19:06Z</dc:date>
    </item>
  </channel>
</rss>

