<?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 Numeric Variables by Percentile Difference in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679885#M205354</link>
    <description>&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE DIF_SCR AS &lt;BR /&gt;SELECT *&lt;BR /&gt;FROM HAVE&lt;BR /&gt;WHERE HK_SCR - BK_SCR not between -0.001 and 0.001;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Aug 2020 19:35:03 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-08-27T19:35:03Z</dc:date>
    <item>
      <title>Comparing Numeric Variables by Percentile Difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679821#M205324</link>
      <description>&lt;P&gt;I have a data set (roughly 20 million observations) see below of what table looks like.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dlm="09"x;
input ID HK_SCR BK_SCR;
datalines;
123	1.021	1.019
124	0.355	0.355
125	0.781	0.771
126	0.599	0.599
127	2.541	2.513 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm currently trying to find a way to compare differences at a certain placement of the numeric value in HK_SCR &amp;amp; BK_SCR. When examining the HK_SCR and BK_SCR variables at the maximum view (&lt;SPAN&gt;24.8) the differences are minuscule. The code provided will not replicate what I have stored but it gives you a general idea.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I'd like to try to find differences at the third decimal point. For example, ID=124 id like to categorize these as = to each other&amp;nbsp;so that they are excluded from my join where HK_SCR &amp;lt;&amp;gt; BK_SCR. Or if there is an If then statement I can utilize to accomplish this? Also not sure of the impacts of the round function&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;"round(var,.001)"&amp;nbsp;&lt;SPAN&gt;and how that will impact my SCR Variables. I've included my two codes that do not successfully&amp;nbsp;accomplish this.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
   CREATE TABLE DIF_SCR AS 
   SELECT ID, 
          HK_SCR, 
          BK_SCR
      FROM HAVE
      WHERE HK_SCR &amp;lt;&amp;gt; BK_SCR
group by ID;
QUIT;

data DIF_1;
set HAVE;
if HK_SCR &amp;lt;&amp;gt; BK_SCR then FLAG=1; ELSE FLAG=0;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Aug 2020 17:48:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679821#M205324</guid>
      <dc:creator>bknitch</dc:creator>
      <dc:date>2020-08-27T17:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Numeric Variables by Percentile Difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679828#M205329</link>
      <description>&lt;P&gt;You can try using the &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0tj6cmga7p8qln1ejh6ebevm0c9.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;ROUND&lt;/A&gt; function, which will allow you to detect differences in the first N decimals places.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your example on ID 124 is different in the second decimal place, so its not clear why you think these are equal according to your statement "&lt;SPAN&gt;I'd like to try to find differences at the third decimal point."&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 17:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679828#M205329</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-27T17:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Numeric Variables by Percentile Difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679836#M205330</link>
      <description>That was a mistake by me, i entered the wrong values. Let me Edit that.</description>
      <pubDate>Thu, 27 Aug 2020 17:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679836#M205330</guid>
      <dc:creator>bknitch</dc:creator>
      <dc:date>2020-08-27T17:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Numeric Variables by Percentile Difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679850#M205335</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; I took a random sample where values were the same and tested the Round function. It did not work unfortunately.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 17:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679850#M205335</guid>
      <dc:creator>bknitch</dc:creator>
      <dc:date>2020-08-27T17:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Numeric Variables by Percentile Difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679852#M205337</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192500"&gt;@bknitch&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; I took a random sample where values were the same and tested the Round function. It did not work unfortunately.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's impossible to respond to this, without knowing what you did and what data you used.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 18:00:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679852#M205337</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-27T18:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Numeric Variables by Percentile Difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679858#M205341</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA TEST1ROUND;&lt;BR /&gt;set COMPARE;&lt;BR /&gt;HK_SCR1=round(HK_SCR,0.001);
BK_SCR1=round(BK_SCR,0.001);
run;

data HAVE(Drop=MY_ID);
set test1round;
ID=MY_ID;
ID=1234;
if HK_SCR1 &amp;lt;&amp;gt; BK_SCR1 then FLAG=1; ELSE FLAG=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Here is my output, i can't show the ID variables due to privacy so i just renamed them to 1234. These three are all different ID's.&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 288pt;" border="0" width="384" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl64" style="height: 15.0pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="border-left: none; width: 48pt;"&gt;HK_SCR&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="border-left: none; width: 48pt;"&gt;BK_SCR&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="border-left: none; width: 48pt;"&gt;HK_SCR1&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="border-left: none; width: 48pt;"&gt;BK_SCR1&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="border-left: none; width: 48pt;"&gt;FLAG&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" class="xl63" style="height: 15.0pt; border-top: none;"&gt;1234&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0.339&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0.339&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0.339&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0.339&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" class="xl63" style="height: 15.0pt; border-top: none;"&gt;1234&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;3.865&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;3.859&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;3.865&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;3.859&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" class="xl63" style="height: 15.0pt; border-top: none;"&gt;1234&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0.565&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0.565&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0.565&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0.565&lt;/TD&gt;
&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Thu, 27 Aug 2020 18:24:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679858#M205341</guid>
      <dc:creator>bknitch</dc:creator>
      <dc:date>2020-08-27T18:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Numeric Variables by Percentile Difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679867#M205343</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192500"&gt;@bknitch&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In SAS the "&amp;lt;&amp;gt;" operator has different meanings: In WHERE conditions and PROC SQL it may be interpreted as "not equal to", but in most other places (e.g. IF conditions as in your example) it is interpreted as the &lt;EM&gt;maximum&lt;/EM&gt; operator*. So, you need to use an (unambiguous)&amp;nbsp;"not equal to" operator such as &lt;FONT face="courier new,courier"&gt;ne&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;~=&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* see log message&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "MAX".&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Aug 2020 18:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679867#M205343</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-08-27T18:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Numeric Variables by Percentile Difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679885#M205354</link>
      <description>&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE DIF_SCR AS &lt;BR /&gt;SELECT *&lt;BR /&gt;FROM HAVE&lt;BR /&gt;WHERE HK_SCR - BK_SCR not between -0.001 and 0.001;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 19:35:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/679885#M205354</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-08-27T19:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Numeric Variables by Percentile Difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/680022#M205428</link>
      <description>This worked, thanks for the solution!</description>
      <pubDate>Fri, 28 Aug 2020 13:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-Numeric-Variables-by-Percentile-Difference/m-p/680022#M205428</guid>
      <dc:creator>bknitch</dc:creator>
      <dc:date>2020-08-28T13:36:28Z</dc:date>
    </item>
  </channel>
</rss>

