<?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: Proc SQL full join? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/511119#M137538</link>
    <description>&lt;P&gt;Thanks for all of your wonderful help!&lt;/P&gt;</description>
    <pubDate>Wed, 07 Nov 2018 18:49:28 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2018-11-07T18:49:28Z</dc:date>
    <item>
      <title>Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507198#M136079</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to combine three tables with everything inside by ID and Place.&amp;nbsp;&amp;nbsp; I&amp;nbsp;am trying to&amp;nbsp;use Proc SQL full join so that I don't need to sort the table.&amp;nbsp;&amp;nbsp; I wrote the code below.&amp;nbsp;&amp;nbsp; It seems didn't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table final as
   select a.*,  
             b.*,
             c.*
from test1 a
   full join test2 b on a.ID=b.ID and a.place=b.place  &lt;BR /&gt;   full join test3 c on a.ID=c.ID and a.place=c.place&amp;nbsp; 
   where date ne . 
   order by ID place;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507198#M136079</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2018-10-24T15:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507200#M136080</link>
      <description>&lt;P&gt;something like this?&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table final as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.*,&lt;BR /&gt;c.*&lt;BR /&gt;from&lt;BR /&gt;test1 a&lt;BR /&gt;full join test2 b on a.ID = b.ID and a.Place = b.Place&lt;BR /&gt;full join test3 c on a.ID = c.ID and a.Place = c.Place&lt;BR /&gt;where date ne .&lt;BR /&gt;order by ID place;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507200#M136080</guid>
      <dc:creator>utrocketeng</dc:creator>
      <dc:date>2018-10-24T15:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507202#M136082</link>
      <description>&lt;P&gt;I think&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6777"&gt;@utrocketeng&lt;/a&gt;&amp;nbsp; is in the right direction, but just concerned if date variable exists in more than one dataset, then you may have to prefix it with an alias to avoid ambiguity.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507202#M136082</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-24T15:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507203#M136083</link>
      <description>&lt;P&gt;good observation&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;you may need to add the 'a' alias to the&amp;nbsp;date filter:&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table final as&lt;BR /&gt;select&lt;BR /&gt;a.*,&lt;BR /&gt;b.*,&lt;BR /&gt;c.*&lt;BR /&gt;from&lt;BR /&gt;test1 a&lt;BR /&gt;full join test2 b on a.ID = b.ID and a.Place = b.Place&lt;BR /&gt;full join test3 c on a.ID = c.ID and a.Place = c.Place&lt;BR /&gt;where a.date ne .&lt;BR /&gt;order by ID place;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:37:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507203#M136083</guid>
      <dc:creator>utrocketeng</dc:creator>
      <dc:date>2018-10-24T15:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507204#M136084</link>
      <description>&lt;P&gt;I got worning message:&lt;/P&gt;
&lt;P&gt;WARNING: Variable id already exists on file WORK.FINAL.&lt;/P&gt;
&lt;P&gt;WARNING: Variable&amp;nbsp;place already exists on file WORK.FINAL.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507204#M136084</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2018-10-24T15:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507210#M136089</link>
      <description>&lt;P&gt;Well that's exactly what rock engineer and I were discussing. You just need to list down col names rather than use *&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507210#M136089</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-24T15:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507211#M136090</link>
      <description>&lt;P&gt;Actually, I popped up another question.&amp;nbsp;&amp;nbsp; I not only want to have the overlapped ID in all of the table but the ID is not duplicated.&amp;nbsp;&amp;nbsp; How to do this?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507211#M136090</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2018-10-24T15:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507213#M136092</link>
      <description>&lt;P&gt;Too many variables names to list them all, I have 900 for each table.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:53:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507213#M136092</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2018-10-24T15:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507219#M136096</link>
      <description>&lt;P&gt;Switch to datastep. If you want code help, plz post a sample of HAVE and WANT&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 16:05:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507219#M136096</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-24T16:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507238#M136112</link>
      <description>&lt;P&gt;coalesce(a.id, b.id, c.id) as id&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and...I think that if you have records in each table that are duplicate for id and place, then you may need to connect b.place to c.place to keep from generating a cartesian product.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 17:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507238#M136112</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2018-10-24T17:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507406#M136200</link>
      <description>900 variables...just stop there. Unless you have a specific data mining task at hand, that is not a viable approach. For starters is makes programming awkward, which you just now should realize. So rethinking your data structure could be yiur6fira concern.&lt;BR /&gt;If you still want to go on this track, macro programming with DICTIONARY.CLOUMNS will be your best friend.</description>
      <pubDate>Thu, 25 Oct 2018 06:09:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/507406#M136200</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-10-25T06:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/511119#M137538</link>
      <description>&lt;P&gt;Thanks for all of your wonderful help!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 18:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/511119#M137538</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2018-11-07T18:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL full join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/511142#M137543</link>
      <description>I like to get more for less&lt;BR /&gt;Coalesce these date variables to select where only one is non-missing or "product" them to select where all are non-missing&lt;BR /&gt;PROC SQL ;&lt;BR /&gt;create table final as&lt;BR /&gt;select coalescec( a.id, b.id, c.id ) as abc_id&lt;BR /&gt;, coalescec( a.place, b.place, c.place) as abc_place&lt;BR /&gt;, coalesce( a.date, b.date, c.date) as abc_date&lt;BR /&gt;,        max( a.date, b.date, c.date) as latest_date&lt;BR /&gt;,         min( a.date, b.date, c.date) as earliest_date&lt;BR /&gt;, *&lt;BR /&gt;From &lt;BR /&gt;test1 a&lt;BR /&gt;full join test2 b on a.ID = b.ID and a.Place = b.Place&lt;BR /&gt;full join test3 c on a.ID = c.ID and a.Place = c.Place&lt;BR /&gt;where a.date * b.date *c.date is not null&lt;BR /&gt;(Alternatively &lt;BR /&gt; Where latest_date is not null)&lt;BR /&gt;&lt;BR /&gt;order by abc_ID, abc_place;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;Sorry this is untested as I haven't yet found a way of testing sas code on this smartphone</description>
      <pubDate>Wed, 07 Nov 2018 19:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-full-join/m-p/511142#M137543</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2018-11-07T19:18:03Z</dc:date>
    </item>
  </channel>
</rss>

