<?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: Adjustment of amount between two tables in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adjustment-of-amount-between-two-tables/m-p/540801#M33226</link>
    <description>&lt;P&gt;Post test data in the form of a datastep using the code window (its the {i} above post area).&lt;/P&gt;
&lt;P&gt;As such it seems that you want to merge the big number from table two onto the last record of the first table, and take that number off.&amp;nbsp; If so:&lt;/P&gt;
&lt;PRE&gt;data want;
  merge data_1 data_2 (rename=(amt=_amt));
  by cif;
run;

data want;
  set want;
  by cif;
  retain running;
  running=ifn(first.cif,amt,sum(running,amt));
  if last.cif then new_amt=running-_amt;
run;&lt;/PRE&gt;</description>
    <pubDate>Wed, 06 Mar 2019 15:18:07 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2019-03-06T15:18:07Z</dc:date>
    <item>
      <title>Adjustment of amount between two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adjustment-of-amount-between-two-tables/m-p/540795#M33223</link>
      <description>&lt;P&gt;Table data_1&lt;BR /&gt;CIF&amp;nbsp;ACNO&amp;nbsp;AMT&lt;BR /&gt;123&amp;nbsp;14&amp;nbsp;100&lt;BR /&gt;123&amp;nbsp;15&amp;nbsp;200&lt;BR /&gt;123&amp;nbsp;16&amp;nbsp;200&lt;BR /&gt;159&amp;nbsp;17&amp;nbsp;100&lt;BR /&gt;159&amp;nbsp;18&amp;nbsp;200&lt;BR /&gt;159&amp;nbsp;19&amp;nbsp;200&lt;BR /&gt;159&amp;nbsp;20&amp;nbsp;200&lt;BR /&gt;159&amp;nbsp;30&amp;nbsp;200&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table data_2&lt;BR /&gt;CIF&amp;nbsp;AMT&lt;BR /&gt;123&amp;nbsp;-400&lt;BR /&gt;159&amp;nbsp;-1500&lt;/P&gt;&lt;P&gt;Please guide for SAS procedure for the following: DATA_1.AMT should be mapped BY CIF and adjusted by DATA_2.AMT and the both table updated with&amp;nbsp;NEW_AMT&amp;nbsp;as under:&lt;/P&gt;&lt;P&gt;&amp;nbsp;Table data_1&lt;BR /&gt;CIF&amp;nbsp;ACNO&amp;nbsp;AMT &amp;nbsp;NEW_AMT&lt;BR /&gt;123&amp;nbsp;14&amp;nbsp;100 &amp;nbsp;0&lt;BR /&gt;123&amp;nbsp;15&amp;nbsp;200 &amp;nbsp;0&lt;BR /&gt;123&amp;nbsp;16&amp;nbsp;200 &amp;nbsp;100&lt;BR /&gt;159&amp;nbsp;17&amp;nbsp;100 &amp;nbsp;0&lt;BR /&gt;159&amp;nbsp;18&amp;nbsp;200 &amp;nbsp;0&lt;BR /&gt;159&amp;nbsp;19&amp;nbsp;200 &amp;nbsp;0&lt;BR /&gt;159&amp;nbsp;20&amp;nbsp;200 &amp;nbsp;0&lt;BR /&gt;159&amp;nbsp;30&amp;nbsp;200 &amp;nbsp;0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table data_2&lt;/P&gt;&lt;P&gt;CIF&amp;nbsp;AMT&amp;nbsp;NEW_AMT&lt;BR /&gt;123&amp;nbsp;-400&amp;nbsp;0&lt;BR /&gt;159&amp;nbsp;-1500&amp;nbsp;-600&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 14:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adjustment-of-amount-between-two-tables/m-p/540795#M33223</guid>
      <dc:creator>ranjit1</dc:creator>
      <dc:date>2019-03-06T14:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Adjustment of amount between two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adjustment-of-amount-between-two-tables/m-p/540801#M33226</link>
      <description>&lt;P&gt;Post test data in the form of a datastep using the code window (its the {i} above post area).&lt;/P&gt;
&lt;P&gt;As such it seems that you want to merge the big number from table two onto the last record of the first table, and take that number off.&amp;nbsp; If so:&lt;/P&gt;
&lt;PRE&gt;data want;
  merge data_1 data_2 (rename=(amt=_amt));
  by cif;
run;

data want;
  set want;
  by cif;
  retain running;
  running=ifn(first.cif,amt,sum(running,amt));
  if last.cif then new_amt=running-_amt;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Mar 2019 15:18:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adjustment-of-amount-between-two-tables/m-p/540801#M33226</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-03-06T15:18:07Z</dc:date>
    </item>
  </channel>
</rss>

