<?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 2 amount values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265048#M310316</link>
    <description>&lt;P&gt;Take a closer look at the code. It joins the table Have to itself, Have. &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2016 10:17:27 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-04-20T10:17:27Z</dc:date>
    <item>
      <title>comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265037#M310311</link>
      <description>&lt;P&gt;hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;iam trying to monitor some financial figures. i have 2 values that i need to work with but i just dont have an idea on how i will write this interms of sas coding. please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my values are as follows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Trans_Type&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Amount&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;salary&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;10000&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Cheq dep&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1000&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Teller dep&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5000&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my desire results is that any amount that is more than 20% of the salary should be flagged 1. and any amount below 20% of the salary should be flagged 0. anyone please help urgently!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 09:21:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265037#M310311</guid>
      <dc:creator>umar_milanzi</dc:creator>
      <dc:date>2016-04-20T09:21:21Z</dc:date>
    </item>
    <item>
      <title>comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265036#M310314</link>
      <description>&lt;P&gt;hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;iam trying to monitor some financial figures. i have 2 values that i need to work with but i just dont have an idea on how i will write this interms of sas coding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my values are as follows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Trans_Type&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Amount&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;salary&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;10000&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Cheq dep&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1000&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Teller dep&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5000&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my desire results is that any amount that is more than 20% of the salary should be flagged 1. and any amount below 20% of the salary should be flagged 0. anyone please help urgently!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 09:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265036#M310314</guid>
      <dc:creator>umar_milanzi</dc:creator>
      <dc:date>2016-04-20T09:21:08Z</dc:date>
    </item>
    <item>
      <title>comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265039#M310312</link>
      <description>&lt;P&gt;hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;iam trying to monitor some financial figures. i have 2 values that i need to work with but i just dont have an idea on how i will write this interms of sas coding. please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my values are as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trans_Type &amp;nbsp; &amp;nbsp; &amp;nbsp;Amount&lt;/P&gt;&lt;P&gt;Salary &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10000&lt;/P&gt;&lt;P&gt;Cheq Dep &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1000&lt;/P&gt;&lt;P&gt;Sandry Dep &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2000&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;my desire results is that any amount that is more than 20% of the salary should be flagged 1. and any amount below 20% of the salary should be flagged 0. anyone please help urgently!!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 09:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265039#M310312</guid>
      <dc:creator>umar_milanzi</dc:creator>
      <dc:date>2016-04-20T09:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265044#M310313</link>
      <description>&lt;P&gt;Please post some more sample data and expected output. You'll need to modify it to match your data structure but it should help you get started.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc SQL;
Create table want as
Select a.id, a.type, a.amount, case when  a.amount/b.amount &amp;gt;= 0.2 then 1 else 0 as flag
From have as a
Left join have as b
On a.id = b.id
And a.type ne 'Salary' and b.type. = 'Salary';
Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You our can merge data with itself via SQL and then do calculation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 09:59:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265044#M310313</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-20T09:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265046#M310315</link>
      <description>&lt;P&gt;Hi Reeza&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the clarity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i see that your code joins two tables. how will the code be if the data is contained in one table. like in my sample code provided. how can i compare first value of 'Salary' to other values?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 10:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265046#M310315</guid>
      <dc:creator>umar_milanzi</dc:creator>
      <dc:date>2016-04-20T10:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265048#M310316</link>
      <description>&lt;P&gt;Take a closer look at the code. It joins the table Have to itself, Have. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 10:17:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265048#M310316</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-20T10:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265049#M310317</link>
      <description>&lt;P&gt;Thanks Reeza&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 10:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265049#M310317</guid>
      <dc:creator>umar_milanzi</dc:creator>
      <dc:date>2016-04-20T10:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265059#M310318</link>
      <description>&lt;P&gt;data m1;&lt;BR /&gt;input type $ amount;&lt;BR /&gt;cards;&lt;BR /&gt;sal 10000&lt;BR /&gt;cheq 2000&lt;BR /&gt;teller 5000&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data m2;&lt;BR /&gt;set m1;&lt;BR /&gt;if type='sal' then x=amount;&lt;BR /&gt;retain x;&lt;BR /&gt;if amount/x &amp;gt; 0.20 then flag=1; else flag=0;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc print;run;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 11:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265059#M310318</guid>
      <dc:creator>Manu_SAS</dc:creator>
      <dc:date>2016-04-20T11:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265062#M310319</link>
      <description>&lt;P&gt;thanks Manu&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you guys are stars i truly appreciate this&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 12:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265062#M310319</guid>
      <dc:creator>umar_milanzi</dc:creator>
      <dc:date>2016-04-20T12:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265065#M310320</link>
      <description>&lt;P&gt;What if Salary isn't in the first record but a later record?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 12:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265065#M310320</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-20T12:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 amount values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265089#M310321</link>
      <description>&lt;P&gt;In that case, it will not work. Even i thought the same. We can do one thing, capture the salary in macro variable and using it in the datastep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data m1;&lt;BR /&gt;input type $ amount;&lt;BR /&gt;cards;&lt;BR /&gt;sal 10000&lt;BR /&gt;cheq 2000&lt;BR /&gt;teller 5000&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;select amount into : amt from m1 where type='sal';&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;data m2;&lt;BR /&gt;set m1;&lt;BR /&gt;x=&amp;amp;amt.;&lt;BR /&gt;if amount/x &amp;gt; 0.20 then flag=1; else flag=0;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;~Manohar&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 13:15:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-2-amount-values/m-p/265089#M310321</guid>
      <dc:creator>Manu_SAS</dc:creator>
      <dc:date>2016-04-20T13:15:39Z</dc:date>
    </item>
  </channel>
</rss>

