<?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 How to merge two tables while giving variable values-II in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-merge-two-tables-while-giving-variable-values-II/m-p/122774#M259892</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;Hi SAS Community,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;I have two tables (Have_1 and Have_2).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Have_1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;informat&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Current_date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Current_date&amp;nbsp;&amp;nbsp; Account_number $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;14&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Arrears_Band $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;17&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;23&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp; balance bank_number;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Current_date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;28FEB2010&amp;nbsp; 111&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAR2010&amp;nbsp; 111&amp;nbsp; Current 20 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAY2010&amp;nbsp; 111&amp;nbsp; 30 - 60 30 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;28FEB2010&amp;nbsp; 444&amp;nbsp; Current 40 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAR2010&amp;nbsp; 444&amp;nbsp; 30 - 60 50 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30APR2010&amp;nbsp; 444&amp;nbsp; 30 - 60 60 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAY2010&amp;nbsp; 444&amp;nbsp; Current 70 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30APR2010&amp;nbsp; 555&amp;nbsp; Current 80 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAY2010&amp;nbsp; 555&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 90 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31AUG2011&amp;nbsp; 555&amp;nbsp; 90 +&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30SEP2011&amp;nbsp; 555&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp; 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAY2010&amp;nbsp; 666&amp;nbsp; Current 15 400&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31AUG2011&amp;nbsp; 666&amp;nbsp; 90 +&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 400&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30SEP2011&amp;nbsp; 666&amp;nbsp; Current 30 400&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Have_2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;informat&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Post_date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Post_date Account_number $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;14&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Net_Write_off_total_USD bank_number;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Post_date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31AUG2010&amp;nbsp; 111&amp;nbsp; 50 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31AUG2010&amp;nbsp; 111&amp;nbsp; 50 200&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30SEP2011&amp;nbsp; 555&amp;nbsp; 77 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30SEP2011&amp;nbsp; 666&amp;nbsp; 77 300&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;Question:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;I need to join these 2 tables so that I could get the answer below. It is mandatory that I need to keep all the records in have_1 table regardless of whether the have_2 table is having corresponding matching records or not. But reverse is not mandatory, i.e. have_2 table may have excess (non matching) records, &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;and they should not show up in final table that I want.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: Helvetica; color: #575757; font-size: 5pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;Answer:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp; Final data set should be like this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt;"&gt;Notice the 2 records from have_2 table are embedded within have_1 table in date sequence. And a value called “&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: #ffffc0; color: red; font-size: 10pt;"&gt;writoff” was assigned.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt; text-decoration: underline;"&gt;Current_date&amp;nbsp; Account_number&amp;nbsp;&amp;nbsp; Arrears_Band&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; balance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bank_number&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="margin-left: 0.25pt; border: #4f493b 1pt solid;"&gt;&lt;TBODY&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;28FEB2010&amp;nbsp; 111&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAR2010&amp;nbsp; 111&amp;nbsp; Current 20 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAY2010&amp;nbsp; 111&amp;nbsp; 30 - 60 30 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: #ffffc0; color: red; font-size: 10pt;"&gt;31AUG2010&amp;nbsp; 111&amp;nbsp; writoff 50 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;28FEB2010&amp;nbsp; 444&amp;nbsp; Current 40 900&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAR2010&amp;nbsp; 444&amp;nbsp; 30 - 60 50 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;30APR2010&amp;nbsp; 444&amp;nbsp; 30 - 60 60 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAY2010&amp;nbsp; 444&amp;nbsp; Current 70 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;30APR2010&amp;nbsp; 555&amp;nbsp; Current 80 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAY2010&amp;nbsp; 555&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 90 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31AUG2011&amp;nbsp; 555&amp;nbsp; 90 +&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;30SEP2011&amp;nbsp; 555&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp; 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: #ffffc0; color: red; font-size: 10pt;"&gt;30SEP2011&amp;nbsp; 555&amp;nbsp; writoff 77 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: Helvetica; color: #575757; font-size: 5pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAY2010&amp;nbsp; 666&amp;nbsp; Current 15 400&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31AUG2011&amp;nbsp; 666&amp;nbsp; 90 +&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 400 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;30SEP2011&amp;nbsp; 666&amp;nbsp; Current 30 400&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;The code below (Ksharp is acknowledged) generates the wanted table to some extent but I have newly included bank_number variable to reflect business reality. Now the results are misleading us. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; have_1 have_2(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=inb&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;rename&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=(Post_date=Current_date Net_Write_off_total_USD=balance)) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Account_number;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; inb &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Arrears_Band=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'writoff '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=want;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Account_number Current_date;&lt;/SPAN&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This is the output generated by above code. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I have striken through 2 records, and they should not be in the output. Reason is their bank_number s are not matching although account_number s are matching. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;Current_date Account_number&amp;nbsp;&amp;nbsp; Arrears_Band&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; balance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bank_number&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #ff00ff;"&gt;these are heading of the output table&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="border: #4f493b 1pt solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;28FEB2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;111&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;100&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAR2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;111&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;100&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAY2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;111&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30 - 60&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;100&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31AUG2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;111&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;writoff&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;50&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;100&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;31AUG2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;111&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;writoff&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;50&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;200&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;28FEB2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;444&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;40&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;900&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAR2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;444&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30 - 60&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;50&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;900&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30APR2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;444&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30 - 60&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;60&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;900&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAY2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;444&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;70&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;900&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30APR2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;555&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;80&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;700&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAY2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;555&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;90&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;700&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31AUG2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;555&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;90 +&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;12&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;700&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30SEP2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;555&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;0&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;700&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30SEP2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;555&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;writoff&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;77&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;700&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAY2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;666&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;400&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31AUG2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;666&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;90 +&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;400&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30SEP2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;666&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;400&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;30SEP2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;666&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;writoff&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;77&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;300&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I would appreciate any help to generate the correct table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Mirisage&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 15 Sep 2012 21:57:01 GMT</pubDate>
    <dc:creator>Mirisage</dc:creator>
    <dc:date>2012-09-15T21:57:01Z</dc:date>
    <item>
      <title>How to merge two tables while giving variable values-II</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-merge-two-tables-while-giving-variable-values-II/m-p/122774#M259892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;Hi SAS Community,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;I have two tables (Have_1 and Have_2).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Have_1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;informat&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Current_date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Current_date&amp;nbsp;&amp;nbsp; Account_number $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;14&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Arrears_Band $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;17&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;23&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp; balance bank_number;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Current_date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;28FEB2010&amp;nbsp; 111&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAR2010&amp;nbsp; 111&amp;nbsp; Current 20 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAY2010&amp;nbsp; 111&amp;nbsp; 30 - 60 30 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;28FEB2010&amp;nbsp; 444&amp;nbsp; Current 40 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAR2010&amp;nbsp; 444&amp;nbsp; 30 - 60 50 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30APR2010&amp;nbsp; 444&amp;nbsp; 30 - 60 60 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAY2010&amp;nbsp; 444&amp;nbsp; Current 70 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30APR2010&amp;nbsp; 555&amp;nbsp; Current 80 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAY2010&amp;nbsp; 555&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 90 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31AUG2011&amp;nbsp; 555&amp;nbsp; 90 +&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30SEP2011&amp;nbsp; 555&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp; 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31MAY2010&amp;nbsp; 666&amp;nbsp; Current 15 400&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31AUG2011&amp;nbsp; 666&amp;nbsp; 90 +&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 400&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30SEP2011&amp;nbsp; 666&amp;nbsp; Current 30 400&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Have_2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;informat&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Post_date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Post_date Account_number $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;14&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Net_Write_off_total_USD bank_number;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Post_date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31AUG2010&amp;nbsp; 111&amp;nbsp; 50 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;31AUG2010&amp;nbsp; 111&amp;nbsp; 50 200&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30SEP2011&amp;nbsp; 555&amp;nbsp; 77 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30SEP2011&amp;nbsp; 666&amp;nbsp; 77 300&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;Question:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;I need to join these 2 tables so that I could get the answer below. It is mandatory that I need to keep all the records in have_1 table regardless of whether the have_2 table is having corresponding matching records or not. But reverse is not mandatory, i.e. have_2 table may have excess (non matching) records, &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;and they should not show up in final table that I want.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: Helvetica; color: #575757; font-size: 5pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;Answer:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp; Final data set should be like this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: red; font-size: 10pt;"&gt;Notice the 2 records from have_2 table are embedded within have_1 table in date sequence. And a value called “&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: #ffffc0; color: red; font-size: 10pt;"&gt;writoff” was assigned.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt; text-decoration: underline;"&gt;Current_date&amp;nbsp; Account_number&amp;nbsp;&amp;nbsp; Arrears_Band&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; balance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bank_number&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="margin-left: 0.25pt; border: #4f493b 1pt solid;"&gt;&lt;TBODY&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;28FEB2010&amp;nbsp; 111&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAR2010&amp;nbsp; 111&amp;nbsp; Current 20 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAY2010&amp;nbsp; 111&amp;nbsp; 30 - 60 30 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: #ffffc0; color: red; font-size: 10pt;"&gt;31AUG2010&amp;nbsp; 111&amp;nbsp; writoff 50 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;28FEB2010&amp;nbsp; 444&amp;nbsp; Current 40 900&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAR2010&amp;nbsp; 444&amp;nbsp; 30 - 60 50 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;30APR2010&amp;nbsp; 444&amp;nbsp; 30 - 60 60 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAY2010&amp;nbsp; 444&amp;nbsp; Current 70 900&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;30APR2010&amp;nbsp; 555&amp;nbsp; Current 80 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAY2010&amp;nbsp; 555&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 90 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31AUG2011&amp;nbsp; 555&amp;nbsp; 90 +&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;30SEP2011&amp;nbsp; 555&amp;nbsp; NPNA&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp; 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: #ffffc0; color: red; font-size: 10pt;"&gt;30SEP2011&amp;nbsp; 555&amp;nbsp; writoff 77 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: Helvetica; color: #575757; font-size: 5pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31MAY2010&amp;nbsp; 666&amp;nbsp; Current 15 400&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;31AUG2011&amp;nbsp; 666&amp;nbsp; 90 +&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 400 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;30SEP2011&amp;nbsp; 666&amp;nbsp; Current 30 400&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;The code below (Ksharp is acknowledged) generates the wanted table to some extent but I have newly included bank_number variable to reflect business reality. Now the results are misleading us. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; have_1 have_2(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=inb&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;rename&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=(Post_date=Current_date Net_Write_off_total_USD=balance)) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Account_number;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; inb &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Arrears_Band=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'writoff '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=want;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Account_number Current_date;&lt;/SPAN&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This is the output generated by above code. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I have striken through 2 records, and they should not be in the output. Reason is their bank_number s are not matching although account_number s are matching. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;Current_date Account_number&amp;nbsp;&amp;nbsp; Arrears_Band&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; balance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bank_number&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #ff00ff;"&gt;these are heading of the output table&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="border: #4f493b 1pt solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;28FEB2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;111&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;100&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAR2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;111&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;100&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAY2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;111&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30 - 60&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;100&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31AUG2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;111&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;writoff&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;50&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;100&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;31AUG2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;111&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;writoff&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;50&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;200&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;28FEB2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;444&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;40&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;900&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAR2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;444&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30 - 60&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;50&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;900&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30APR2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;444&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30 - 60&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;60&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;900&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAY2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;444&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;70&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;900&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30APR2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;555&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;80&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;700&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAY2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;555&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;90&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;700&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31AUG2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;555&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;90 +&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;12&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;700&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30SEP2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;555&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;0&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;700&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30SEP2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;555&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;writoff&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;77&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;700&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31MAY2010&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;666&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;400&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;31AUG2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;666&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;90 +&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;400&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30SEP2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;666&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;400&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;30SEP2011&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;666&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;writoff&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;77&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" valign="top"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: red; background: yellow; text-decoration: line-through; font-family: 'Times New Roman';"&gt;300&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I would appreciate any help to generate the correct table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Mirisage&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Sep 2012 21:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-merge-two-tables-while-giving-variable-values-II/m-p/122774#M259892</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-09-15T21:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two tables while giving variable values-II</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-merge-two-tables-while-giving-variable-values-II/m-p/224981#M259893</link>
      <description>&lt;P&gt;This gets the solution you are looking for, edited for length and rename:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;length arrears_band $10.;&lt;BR /&gt;merge have_1 (in=a)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; have_2 (in=b rename=(post_date=Current_date Net_Write_off_total_USD=balance));&lt;BR /&gt;by account_number bank_number;&lt;BR /&gt;if missing(arrears_band) then Arrears_Band = 'Write Off';&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 15:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-merge-two-tables-while-giving-variable-values-II/m-p/224981#M259893</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-09-10T15:30:12Z</dc:date>
    </item>
  </channel>
</rss>

