<?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 Why cannot I merge these two tables-II? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123431#M33922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SAS Forum,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to stack the attached two SAS tables so that I will get a table like below.&amp;nbsp; In below table, the first 5 records are coming from attahced Book2 table.&lt;/P&gt;&lt;P&gt;The "bottom-most bolded record" of below table is coming from the attahced Book1 table.&lt;/P&gt;&lt;P&gt;It is the corresponding counterpart account in Book1 data set where arrerars_band = writoff (I find difficult to explain this).&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl24" height="35" style="border: black 0px solid;" width="62"&gt;Bank_number&lt;/TD&gt;&lt;TD class="xl24" style="border: black 0px solid;" width="68"&gt;Current_date&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="77"&gt;Account_number&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="176"&gt;Short_name&lt;/TD&gt;&lt;TD class="xl24" style="border: black 0px solid;" width="64"&gt;Currency_code&lt;/TD&gt;&lt;TD class="xl24" style="border: black 0px solid;" width="63"&gt;Product_code&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="64"&gt;Currency_short_name&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="79"&gt;Country&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="50"&gt;Transit&lt;/TD&gt;&lt;TD class="xl24" style="border: black 0px solid;" width="59"&gt;Balance&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="90"&gt;Product&lt;/TD&gt;&lt;TD class="xl26" style="border: black 0px solid;" width="60"&gt;Arrears_Band&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl27" height="18" style="border: black 0px solid;"&gt;10&lt;/TD&gt;&lt;TD class="xl28" style="border: black 0px solid;"&gt;28-Feb-10&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;1000000000&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;OOOOOOOOO RRRRRRRR&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;1&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;VVV&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;DDDDDDDD&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Retail&lt;/TD&gt;&lt;TD class="xl31" style="border: black 0px solid;"&gt;1700&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Personal Loan&lt;/TD&gt;&lt;TD class="xl32" style="border: black 0px solid;"&gt;NPNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl27" height="18" style="border: black 0px solid;"&gt;10&lt;/TD&gt;&lt;TD class="xl28" style="border: black 0px solid;"&gt;31-Mar-10&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;1000000000&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;OOOOOOOOO RRRRRRRR&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;1&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;VVV&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;DDDDDDDD&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Retail&lt;/TD&gt;&lt;TD class="xl31" style="border: black 0px solid;"&gt;1700&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Personal Loan&lt;/TD&gt;&lt;TD class="xl32" style="border: black 0px solid;"&gt;NPNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl27" height="18" style="border: black 0px solid;"&gt;10&lt;/TD&gt;&lt;TD class="xl28" style="border: black 0px solid;"&gt;30-Apr-10&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;1000000000&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;OOOOOOOOO RRRRRRRR&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;1&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;VVV&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;DDDDDDDD&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Retail&lt;/TD&gt;&lt;TD class="xl31" style="border: black 0px solid;"&gt;1700&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Personal Loan&lt;/TD&gt;&lt;TD class="xl32" style="border: black 0px solid;"&gt;NPNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl27" height="18" style="border: black 0px solid;"&gt;10&lt;/TD&gt;&lt;TD class="xl28" style="border: black 0px solid;"&gt;31-May-10&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;1000000000&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;OOOOOOOOO RRRRRRRR&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;1&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;VVV&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;DDDDDDDD&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Retail&lt;/TD&gt;&lt;TD class="xl31" style="border: black 0px solid;"&gt;1700&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Personal Loan&lt;/TD&gt;&lt;TD class="xl32" style="border: black 0px solid;"&gt;NPNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl33" height="18" style="border: black 0px solid;"&gt;10&lt;/TD&gt;&lt;TD class="xl34" style="border: black 0px solid;"&gt;30-Jun-10&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;1000000000&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;OOOOOOOOO RRRRRRRR&lt;/TD&gt;&lt;TD class="xl33" style="border: black 0px solid;"&gt;0&lt;/TD&gt;&lt;TD class="xl33" style="border: black 0px solid;"&gt;1&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;VVV&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;DDDDDDDD&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;Retail&lt;/TD&gt;&lt;TD class="xl31" style="border: black 0px solid;"&gt;1700&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;Personal Loan&lt;/TD&gt;&lt;TD class="xl35" style="border: black 0px solid;"&gt;NPNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl36" height="17" style="border: black 0px solid;"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl37" style="border: black 0px solid;"&gt;&lt;STRONG&gt;6-Jul-10&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl38" style="border: black 0px solid;"&gt;&lt;STRONG&gt;1000000000&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl40" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl41" style="border: black 0px solid;"&gt;&lt;STRONG&gt;2216&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;Personal Loan&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl38" style="border: black 0px solid;"&gt;&lt;STRONG&gt;writoff&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #00ccff; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;The account_name called ‘8000000000’in attahced Book2 data set &lt;/STRONG&gt;does not have a corresponding counterpart account in Book1 data set where arrerars_band = writoff.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;So, I do not want the account_number called 8000000000 to show up in my final stacked output file. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;AUTiger and Haikuo helped me to do the below code to tackle a "kind of similar situation" but the current situation in my hand is bit different.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;So, this code is not capable of doing it.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&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;=A.BOOK1 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=file_A;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &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; bank_number Account_number ;&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;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;=A.BOOK2&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Out&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=file_B;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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; bank_number account_number ;&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;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&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; merged_file;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &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; file_B &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_A &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&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; bank_number account_number ;&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;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Would there be way to handle this new situation?&lt;/STRONG&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Thanks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Mirisage&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Sep 2012 01:58:12 GMT</pubDate>
    <dc:creator>Mirisage</dc:creator>
    <dc:date>2012-09-17T01:58:12Z</dc:date>
    <item>
      <title>Why cannot I merge these two tables-II?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123431#M33922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SAS Forum,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to stack the attached two SAS tables so that I will get a table like below.&amp;nbsp; In below table, the first 5 records are coming from attahced Book2 table.&lt;/P&gt;&lt;P&gt;The "bottom-most bolded record" of below table is coming from the attahced Book1 table.&lt;/P&gt;&lt;P&gt;It is the corresponding counterpart account in Book1 data set where arrerars_band = writoff (I find difficult to explain this).&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl24" height="35" style="border: black 0px solid;" width="62"&gt;Bank_number&lt;/TD&gt;&lt;TD class="xl24" style="border: black 0px solid;" width="68"&gt;Current_date&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="77"&gt;Account_number&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="176"&gt;Short_name&lt;/TD&gt;&lt;TD class="xl24" style="border: black 0px solid;" width="64"&gt;Currency_code&lt;/TD&gt;&lt;TD class="xl24" style="border: black 0px solid;" width="63"&gt;Product_code&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="64"&gt;Currency_short_name&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="79"&gt;Country&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="50"&gt;Transit&lt;/TD&gt;&lt;TD class="xl24" style="border: black 0px solid;" width="59"&gt;Balance&lt;/TD&gt;&lt;TD class="xl25" style="border: black 0px solid;" width="90"&gt;Product&lt;/TD&gt;&lt;TD class="xl26" style="border: black 0px solid;" width="60"&gt;Arrears_Band&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl27" height="18" style="border: black 0px solid;"&gt;10&lt;/TD&gt;&lt;TD class="xl28" style="border: black 0px solid;"&gt;28-Feb-10&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;1000000000&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;OOOOOOOOO RRRRRRRR&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;1&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;VVV&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;DDDDDDDD&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Retail&lt;/TD&gt;&lt;TD class="xl31" style="border: black 0px solid;"&gt;1700&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Personal Loan&lt;/TD&gt;&lt;TD class="xl32" style="border: black 0px solid;"&gt;NPNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl27" height="18" style="border: black 0px solid;"&gt;10&lt;/TD&gt;&lt;TD class="xl28" style="border: black 0px solid;"&gt;31-Mar-10&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;1000000000&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;OOOOOOOOO RRRRRRRR&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;1&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;VVV&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;DDDDDDDD&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Retail&lt;/TD&gt;&lt;TD class="xl31" style="border: black 0px solid;"&gt;1700&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Personal Loan&lt;/TD&gt;&lt;TD class="xl32" style="border: black 0px solid;"&gt;NPNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl27" height="18" style="border: black 0px solid;"&gt;10&lt;/TD&gt;&lt;TD class="xl28" style="border: black 0px solid;"&gt;30-Apr-10&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;1000000000&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;OOOOOOOOO RRRRRRRR&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;1&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;VVV&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;DDDDDDDD&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Retail&lt;/TD&gt;&lt;TD class="xl31" style="border: black 0px solid;"&gt;1700&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Personal Loan&lt;/TD&gt;&lt;TD class="xl32" style="border: black 0px solid;"&gt;NPNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl27" height="18" style="border: black 0px solid;"&gt;10&lt;/TD&gt;&lt;TD class="xl28" style="border: black 0px solid;"&gt;31-May-10&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;1000000000&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;OOOOOOOOO RRRRRRRR&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border: black 0px solid;"&gt;1&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;VVV&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;DDDDDDDD&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Retail&lt;/TD&gt;&lt;TD class="xl31" style="border: black 0px solid;"&gt;1700&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;Personal Loan&lt;/TD&gt;&lt;TD class="xl32" style="border: black 0px solid;"&gt;NPNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl33" height="18" style="border: black 0px solid;"&gt;10&lt;/TD&gt;&lt;TD class="xl34" style="border: black 0px solid;"&gt;30-Jun-10&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;1000000000&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;OOOOOOOOO RRRRRRRR&lt;/TD&gt;&lt;TD class="xl33" style="border: black 0px solid;"&gt;0&lt;/TD&gt;&lt;TD class="xl33" style="border: black 0px solid;"&gt;1&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;VVV&lt;/TD&gt;&lt;TD class="xl30" style="border: black 0px solid;"&gt;DDDDDDDD&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;Retail&lt;/TD&gt;&lt;TD class="xl31" style="border: black 0px solid;"&gt;1700&lt;/TD&gt;&lt;TD class="xl29" style="border: black 0px solid;"&gt;Personal Loan&lt;/TD&gt;&lt;TD class="xl35" style="border: black 0px solid;"&gt;NPNA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl36" height="17" style="border: black 0px solid;"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl37" style="border: black 0px solid;"&gt;&lt;STRONG&gt;6-Jul-10&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl38" style="border: black 0px solid;"&gt;&lt;STRONG&gt;1000000000&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl40" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;missing &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl41" style="border: black 0px solid;"&gt;&lt;STRONG&gt;2216&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl39" style="border: black 0px solid;"&gt;&lt;STRONG&gt;Personal Loan&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl38" style="border: black 0px solid;"&gt;&lt;STRONG&gt;writoff&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #00ccff; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;The account_name called ‘8000000000’in attahced Book2 data set &lt;/STRONG&gt;does not have a corresponding counterpart account in Book1 data set where arrerars_band = writoff.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;So, I do not want the account_number called 8000000000 to show up in my final stacked output file. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;AUTiger and Haikuo helped me to do the below code to tackle a "kind of similar situation" but the current situation in my hand is bit different.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;So, this code is not capable of doing it.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&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;=A.BOOK1 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=file_A;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &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; bank_number Account_number ;&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;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;=A.BOOK2&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Out&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=file_B;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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; bank_number account_number ;&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;STRONG style="color: green; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&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; merged_file;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &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; file_B &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_A &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&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; bank_number account_number ;&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;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Would there be way to handle this new situation?&lt;/STRONG&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Thanks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Mirisage&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 01:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123431#M33922</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-09-17T01:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why cannot I merge these two tables-II?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123432#M33923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way if what you want is records that come from both data sets is :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'Courier New'; background: white; color: navy; font-size: 11pt;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; merged_file;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &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; file_B (in= inb)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_A (in= ina)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&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; bank_number account_number ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;if inb and ina;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'Courier New'; background: white; color: navy; font-size: 11pt;"&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 15:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123432#M33923</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-09-17T15:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why cannot I merge these two tables-II?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123433#M33924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like you only want to append records from BOOK1 when the account is also in BOOK2. But that you want to keep all records from BOOK2 whether there is a record in BOOK1 or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case the accounts you want will always have their first record coming from BOOK2.&amp;nbsp; Note that this code is dependent on the order the datasets are listed in the SET statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; retain keep;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; drop keep;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set book2(in=in2) book1(in=in1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; by bank_number account_number;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if first.account_number then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if in2 then keep=1; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else keep=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if keep;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 16:45:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123433#M33924</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-09-17T16:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Why cannot I merge these two tables-II?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123434#M33925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;Could you explain the code.&lt;/P&gt;&lt;P&gt;if its the first of the account number(nothing but from book2)&amp;nbsp; we are giving it a value of 1 for keep variable.&lt;/P&gt;&lt;P&gt;if its not coming from book2(if its not there in book2 ie its from book1) then we give a value of 0 for keep variable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if keep gives us only the ones which have a value of 1(from book2).....if the first of the bank number is from book1(0) its eliminated!!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lastly ,What is the use of retain keep and drop keep statements at the top????&lt;/P&gt;&lt;P&gt;why are we dropping it at the top? and again creating at the bottom????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please explain??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 17:37:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123434#M33925</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-09-17T17:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Why cannot I merge these two tables-II?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123435#M33926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First RETAIN and DROP are examples of&amp;nbsp; non executable statements. That is they are used to compile the data step but do not do anything on each iteration. So it doesn't matter (other than for easy of reading) where in the data step they are coded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When it starts a new account (IF FIRST.ACCOUNT_NUMBER) it assigns a value to the variable KEEP. The RETAIN statement insures that the value stays the same until it is changed.&amp;nbsp; The first record must be from either BOOK2 (in2=1) or BOOK1(in1=1) but cannot be from both as we are using a SET statement instead of MERGE statement.&amp;nbsp; So every record for the same account will have the same value of the KEEP variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF KEEP; is the same as IF NOT KEEP THEN DELETE;.&amp;nbsp; Thus only the accounts we have flagged to keep will be output to the new dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 18:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123435#M33926</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-09-17T18:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why cannot I merge these two tables-II?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123436#M33927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it works for your sample data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=ds.BOOK1 out=file_A;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by bank_number Account_number ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=ds.BOOK2&amp;nbsp; Out=file_B;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by bank_number account_number ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data merged_file;&lt;/P&gt;&lt;P&gt;retain lastacct;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set file_A(in=ina)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_B (in=inb)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;by bank_number account_number ;&lt;/P&gt;&lt;P&gt; sortord=Ina*2+inb*1;&lt;/P&gt;&lt;P&gt;if ina and first.account_number then lastacct=account_number;&lt;/P&gt;&lt;P&gt;if ina or ( inb and lastacct=account_number) then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=merged_file;&lt;/P&gt;&lt;P&gt;by&amp;nbsp; bank_number account_number sortord ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2012 03:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-cannot-I-merge-these-two-tables-II/m-p/123436#M33927</guid>
      <dc:creator>AUTigers</dc:creator>
      <dc:date>2012-09-18T03:18:27Z</dc:date>
    </item>
  </channel>
</rss>

