<?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: comparing values in two different format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/comparing-values-in-two-different-format/m-p/101665#M291047</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At a guess it looks like your col1 represents a percentage (not just amounts with a percentage format).&amp;nbsp; Hence to find the matches you need to multiply col2 by 100 (or divide col1 by 100 - but for rounding reasons multiply col1).&lt;/P&gt;&lt;P&gt;You may find that there are still rounding issues in your data so you may also need to round before comparing or accept a difference of &amp;lt;.01 as denoting equal.&lt;/P&gt;&lt;P&gt;In its simplest form&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data equal (where&amp;nbsp; (col1 = 100 * col2))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unequal (where (col1 &amp;lt;&amp;gt; 100 * col2))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would suggest a more robust version to test the differences &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data equal (where&amp;nbsp; (test = 0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unequal (where (test &amp;gt; 0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test = ABS (col1 - 100 * col2) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then test the unequal differences ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Proc univariate &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = unequal ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var test ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sh&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;ould give you enough information to set a minimum value for test for which you will accept inequality.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;(ie change the condition test = 0 to test &amp;gt; .05 etc)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Aug 2013 06:05:11 GMT</pubDate>
    <dc:creator>RichardinOz</dc:creator>
    <dc:date>2013-08-06T06:05:11Z</dc:date>
    <item>
      <title>comparing values in two different format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-values-in-two-different-format/m-p/101663#M291045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi i have two columns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;col1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col2&lt;/P&gt;&lt;P&gt;----&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -------&lt;/P&gt;&lt;P&gt;29.75&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.30&lt;/P&gt;&lt;P&gt;14.85&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.14&lt;/P&gt;&lt;P&gt;76.15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.76&lt;BR /&gt;43.65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.43&lt;/P&gt;&lt;P&gt;22.55&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.23&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have millions of rows like this. when i tried to create 2 diff datasets one that matches and the other one non matching values, i am not getting the correct datas in non-matching. non matching has both matching as well as non-matching. How can i get the corrct datas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Lakshmi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 20:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-values-in-two-different-format/m-p/101663#M291045</guid>
      <dc:creator>LRN</dc:creator>
      <dc:date>2013-08-05T20:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: comparing values in two different format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-values-in-two-different-format/m-p/101664#M291046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What code are using to determine if they match? And provide some examples of the match/nomatch returning incorrect results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From you example data I'm guessing that you have rounded and not rounded values and possible comparing percents to decimal near-equivalents. If that is the case you'll probable need some more comprehensive rules other than equal/ not equal to meet your matching criteria.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 20:42:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-values-in-two-different-format/m-p/101664#M291046</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-08-05T20:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: comparing values in two different format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-values-in-two-different-format/m-p/101665#M291047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At a guess it looks like your col1 represents a percentage (not just amounts with a percentage format).&amp;nbsp; Hence to find the matches you need to multiply col2 by 100 (or divide col1 by 100 - but for rounding reasons multiply col1).&lt;/P&gt;&lt;P&gt;You may find that there are still rounding issues in your data so you may also need to round before comparing or accept a difference of &amp;lt;.01 as denoting equal.&lt;/P&gt;&lt;P&gt;In its simplest form&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data equal (where&amp;nbsp; (col1 = 100 * col2))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unequal (where (col1 &amp;lt;&amp;gt; 100 * col2))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would suggest a more robust version to test the differences &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data equal (where&amp;nbsp; (test = 0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unequal (where (test &amp;gt; 0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test = ABS (col1 - 100 * col2) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then test the unequal differences ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Proc univariate &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = unequal ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var test ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sh&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;ould give you enough information to set a minimum value for test for which you will accept inequality.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;(ie change the condition test = 0 to test &amp;gt; .05 etc)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Aug 2013 06:05:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-values-in-two-different-format/m-p/101665#M291047</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2013-08-06T06:05:11Z</dc:date>
    </item>
  </channel>
</rss>

