<?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 update in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/update/m-p/130970#M26700</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 two tables a and b.&lt;/P&gt;&lt;P&gt;i need to get email address and phone no from table b. but if the ph no in a is same as in b then keep the one from a, if they are not equal or if it is missing in table a then get from b.&lt;/P&gt;&lt;P&gt;both tables have common id.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Nov 2012 16:55:49 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2012-11-20T16:55:49Z</dc:date>
    <item>
      <title>update</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update/m-p/130970#M26700</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 two tables a and b.&lt;/P&gt;&lt;P&gt;i need to get email address and phone no from table b. but if the ph no in a is same as in b then keep the one from a, if they are not equal or if it is missing in table a then get from b.&lt;/P&gt;&lt;P&gt;both tables have common id.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 16:55:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update/m-p/130970#M26700</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2012-11-20T16:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: update</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update/m-p/130971#M26701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should work; untested.&amp;nbsp; The SQL step adds the additional phone number and the DATA step resolves the missing issue.&amp;nbsp; You might be able to do it in a single query, but possibility of b.phone being missing makes it messy (the MAX function in SQL is different from the one in the DATA step, so the derived variable approach may not work).&amp;nbsp; This assumes there is at most one record in b for each record in a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CREATE TABLE c AS&lt;/P&gt;&lt;P&gt;SELECT a.*, b.phone AS bphone&lt;/P&gt;&lt;P&gt;FROM a&lt;/P&gt;&lt;P&gt;LEFT JOIN b&lt;/P&gt;&lt;P&gt;ON a.id=b.id&lt;/P&gt;&lt;P&gt;ORDER BY a.id;&lt;/P&gt;&lt;P&gt;QUIT; RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA c;&lt;/P&gt;&lt;P&gt;SET c;&lt;/P&gt;&lt;P&gt;IF phone=. THEN phone=bphone;&lt;/P&gt;&lt;P&gt;DROP bphone;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 17:33:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update/m-p/130971#M26701</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2012-11-20T17:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: update</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update/m-p/130972#M26702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't test it without example data, but isn't that precisely what the datastep update statement was designed for?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 17:47:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update/m-p/130972#M26702</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-20T17:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: update</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update/m-p/130973#M26703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;table A&lt;/P&gt;&lt;P&gt;id&amp;nbsp;&amp;nbsp; Ph_no&lt;BR /&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; 6986912255&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp; 7025576682&lt;BR /&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;table B&lt;BR /&gt;id&amp;nbsp;&amp;nbsp; Ph_no&lt;BR /&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; 6986912255&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp; 7025576676&lt;BR /&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; 5167741474&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;output table:&lt;/P&gt;&lt;P&gt;id&amp;nbsp;&amp;nbsp; Ph_no&lt;BR /&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; 6986912255&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp; 7025576676&lt;BR /&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; 5167741474&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 19:39:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update/m-p/130973#M26703</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2012-11-20T19:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: update</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update/m-p/130974#M26704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data A;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input id&amp;nbsp;&amp;nbsp; Ph_no;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; 6986912255&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp; 7025576682&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data B;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input id&amp;nbsp;&amp;nbsp; Ph_no;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; 6986912255&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp; 7025576676&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; 5167741474&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; update A B;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 19:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update/m-p/130974#M26704</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-20T19:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: update</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update/m-p/130975#M26705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update will always overwrite the phone number in A with a non missing value in B, but the OP wants to preserve existing non-numeric values in A.&amp;nbsp; In the past I have used update twice - first to create NewB which is updated with existing data from A, then updated A with NewB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard in Oz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 20:47:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update/m-p/130975#M26705</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2012-11-20T20:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: update</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update/m-p/130976#M26706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think that is what the OP requested (i.e., preserve existing non-numeric values).&amp;nbsp; The original post stated that "&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if the ph no in a is same as in b then keep the one from a".&amp;nbsp; If they are the "same", does it really matter which is kept?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 21:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update/m-p/130976#M26706</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-20T21:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: update</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update/m-p/130977#M26707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It matters when you are a pure perfectionist. In this case,&amp;nbsp; I would have kept my (in=) variables, and if that does not meet my standard, my heart starts burning. &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;LOL, Art, Happy Turkey Day!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 21:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update/m-p/130977#M26707</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-11-20T21:47:37Z</dc:date>
    </item>
  </channel>
</rss>

