<?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: re Updating table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/re-Updating-table/m-p/847090#M334910</link>
    <description>&lt;P&gt;Hi BallardW.....I will remove the two coalescec and run it again and see if that helps. I always thought that I should use coalescec on the variables that the tables are joined on as well. This is good to know.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Nov 2022 16:50:06 GMT</pubDate>
    <dc:creator>twildone</dc:creator>
    <dc:date>2022-11-30T16:50:06Z</dc:date>
    <item>
      <title>re Updating table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-Updating-table/m-p/847075#M334899</link>
      <description>&lt;P&gt;Hi....I am trying to update AccessCampus on the Acad table with AccessCampus from table BAAECE. The records in table BAACE are unique whereas records in Acad could be many. When I run proc sql to create Acad1, it takes a long time to run. I am looking for a better and faster way to join these tables. I was going to try and use Update statement but from what I could find out is that the Update Statement will work if the join was one to one. Any suggestions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    create table BAAECE as 
        select distinct 
            SROffer.Department, 
            SROffer.Course,  
            SROffer.Section,
            SROffer.Programs, 
            SROffer.AccessCampus,  
            SROffer.TermCalendarID, 
            SROffer.SROfferID
        from work.SROffer;
quit;

proc sql noprint;
	create table Acad1 as 
		select distinct
            Acad.ID,
            coalescec(Acad.Department,BAAECE.Department) as Department,
 			coalescec(BAAECE.AccessCampus,Acad.AccessCampus) as AccessCampus,
          	coalescec(Acad.Programs,BAAECE.Programs) as Programs, 
          	coalescec(Acad.Section,BAAECE.Section) as Section, 
          	coalesce(Acad.SROfferID,BAAECE.SROfferID) as SROfferID,  
          	coalesce(Acad.TermCalendarID,BAAECE.TermCalendarID) as TermCalendarID
    from work.Acad left join work.BAAECE on (Acad.SROfferID = BAAECE.SROfferID and Acad.Department = BAAECE.Department and Acad.Programs = BAAECE.Programs
            and Acad.TermCalendarID = BAAECE.TermCalendarID and Acad.Section = BAAECE.Section);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Nov 2022 16:24:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-Updating-table/m-p/847075#M334899</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2022-11-30T16:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: re Updating table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-Updating-table/m-p/847085#M334906</link>
      <description>&lt;P&gt;How many records involved in each table?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you consider a data step MERGE?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Proc SQL update clause does not have any problem with one-to-one but doesn't like attempting to update multiple variables, at least the last time I tried.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These two coalescec requests a bit questionable to include in my opinion as you are using those two values in your JOIN ON criteria. If the join is correct these are just wasting clock cycles, if the join is not correct then I am not sure what benefit they would have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;            coalescec(Acad.Department,BAAECE.Department) as Department,
 		
          	coalescec(Acad.Programs,BAAECE.Programs) as Programs, 
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2022 04:19:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-Updating-table/m-p/847085#M334906</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-12-01T04:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: re Updating table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-Updating-table/m-p/847090#M334910</link>
      <description>&lt;P&gt;Hi BallardW.....I will remove the two coalescec and run it again and see if that helps. I always thought that I should use coalescec on the variables that the tables are joined on as well. This is good to know.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 16:50:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-Updating-table/m-p/847090#M334910</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2022-11-30T16:50:06Z</dc:date>
    </item>
  </channel>
</rss>

