<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: update base table using multi join in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/update-base-table-using-multi-join/m-p/95989#M27157</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot... &lt;/P&gt;&lt;P&gt;The datastep solution works for me.. for some reason the sql process just takes too much time. however the datastep works a lot faster...not sure why..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 29 Apr 2012 11:01:10 GMT</pubDate>
    <dc:creator>NN</dc:creator>
    <dc:date>2012-04-29T11:01:10Z</dc:date>
    <item>
      <title>update base table using multi join</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/update-base-table-using-multi-join/m-p/95987#M27155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a base table of&amp;nbsp; a million or above rows which has 4 variables as provided below.&lt;/P&gt;&lt;P&gt;i wish to update the date and name column in the base table using the values provided in the small_table. The join is to be on the ID and the SUB_ID variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My base table has a composite index defined on it hence i would require a update solution which would not delete the index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone guide me in the correct direction.&lt;/P&gt;&lt;P&gt;DATA BASE_TABLE;&lt;/P&gt;&lt;P&gt;INFILE DATALINES DELIMITER = '|';&lt;/P&gt;&lt;P&gt;INPUT&amp;nbsp; ID1 : $10. SUB_ID : $10. NAME : $30. DATE : DATE9. &lt;/P&gt;&lt;P&gt;DATALINES;&lt;/P&gt;&lt;P&gt;AA|123|NAME1|01JAN2012&lt;/P&gt;&lt;P&gt;AA|134|NAME2|01JAN2012&lt;/P&gt;&lt;P&gt;AB|123|NAME3|01JAN2012&lt;/P&gt;&lt;P&gt;AA|145|NAME4|01JAN2012&lt;/P&gt;&lt;P&gt;;&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;DATA SMALL_TABLE;&lt;/P&gt;&lt;P&gt;INPUT&amp;nbsp; ID1 : $10. SUB_ID : $10. NAME : $30. DATE : DATE9. &lt;/P&gt;&lt;P&gt;DATALINES;&lt;/P&gt;&lt;P&gt;AA|134|NAME6|01MAR2012&lt;/P&gt;&lt;P&gt;AB|123|NAME7|10MAR2012&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2012 16:44:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/update-base-table-using-multi-join/m-p/95987#M27155</guid>
      <dc:creator>NN</dc:creator>
      <dc:date>2012-04-26T16:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: update base table using multi join</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/update-base-table-using-multi-join/m-p/95988#M27156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two methods that will maintain the index :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA BASE(index=(myIndex=(ID1 SUB_ID)));&lt;BR /&gt;INFILE DATALINES DELIMITER = '|';&lt;BR /&gt;INPUT&amp;nbsp; ID1 : $10. SUB_ID : $10. NAME : $30. DATE : DATE9. ;&lt;BR /&gt;DATALINES;&lt;BR /&gt;AA|123|NAME1|01JAN2012&lt;BR /&gt;AA|134|NAME2|01JAN2012&lt;BR /&gt;AB|123|NAME3|01JAN2012&lt;BR /&gt;AA|145|NAME4|01JAN2012&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;DATA SMALL;&lt;BR /&gt;INFILE DATALINES DELIMITER = '|';&lt;BR /&gt;INPUT&amp;nbsp; ID1 : $10. SUB_ID : $10. NAME : $30. DATE : DATE9. ;&lt;BR /&gt;DATALINES;&lt;BR /&gt;AA|134|NAME6|01MAR2012&lt;BR /&gt;AB|123|NAME7|10MAR2012&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select * from base;&lt;BR /&gt;update base as B&lt;BR /&gt;set name=(select name from small as S where B.ID1=S.ID1 and B.SUB_ID=S.SUB_ID),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date=(select date from small as S where B.ID1=S.ID1 and B.SUB_ID=S.SUB_ID)&lt;BR /&gt;where exists (select * from small as S where B.ID1=S.ID1 and B.SUB_ID=S.SUB_ID);&lt;BR /&gt;select * from base;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data base;&lt;BR /&gt;set small(rename=(name=newName date=newDate));&lt;BR /&gt;modify base key=myIndex;&lt;BR /&gt;name=newname;&lt;BR /&gt;date=newDate;&lt;BR /&gt;if _iorc_=0 then replace;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=base; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2012 19:16:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/update-base-table-using-multi-join/m-p/95988#M27156</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-04-26T19:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: update base table using multi join</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/update-base-table-using-multi-join/m-p/95989#M27157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot... &lt;/P&gt;&lt;P&gt;The datastep solution works for me.. for some reason the sql process just takes too much time. however the datastep works a lot faster...not sure why..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Apr 2012 11:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/update-base-table-using-multi-join/m-p/95989#M27157</guid>
      <dc:creator>NN</dc:creator>
      <dc:date>2012-04-29T11:01:10Z</dc:date>
    </item>
  </channel>
</rss>

