<?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: full join in proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/654009#M196459</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for ur support!&lt;/P&gt;&lt;P&gt;Could you tell me how can I further deduplicate it (as per my knowledge full join combines the result of both left and right outer join)&lt;/P&gt;&lt;P&gt;Also, please help me with the sequence/order of SQL syntax as I tried to execute the below program, but it didn't work .&lt;/P&gt;&lt;P&gt;Need to know where should I terminate each statement and in which order, should I use order by syntax first or group by or where condition?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table ph as select* from sashelp.class&lt;BR /&gt;where age&amp;gt;14 order by weight desc group by sex;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 07 Jun 2020 13:49:04 GMT</pubDate>
    <dc:creator>Naveen1111</dc:creator>
    <dc:date>2020-06-07T13:49:04Z</dc:date>
    <item>
      <title>full join in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/653908#M196421</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a question, as I just started learning sas. There are two datasets i.e.(abc, qwe). In dataset ABC we have two obs, but when I used with another datatset (qwe) by using full join, instead of getting two obs, getting three obs on both the side. Below are the mentioned dataset and output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;could someone tell me why I m getting for dataset abc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data abc;&lt;BR /&gt;input a b c d$;&lt;BR /&gt;cards;&lt;BR /&gt;10 20 30 "M"&lt;BR /&gt;89 90 90 "F"&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data qwe;&lt;BR /&gt;input q w c e$;&lt;BR /&gt;cards;&lt;BR /&gt;10 20 30 "M"&lt;BR /&gt;89 90 90 "M"&lt;BR /&gt;89 90 90 "M"&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select* from abc&lt;BR /&gt;full join&lt;BR /&gt;qwe on&lt;BR /&gt;abc. c=qwe. c;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OUTPUT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a b c d q w c e&lt;BR /&gt;ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ&lt;BR /&gt;10 20 30 "M" 10 20 30 "M"&lt;BR /&gt;89 90 90 "F" 89 90 90 "M"&lt;BR /&gt;89 90 90 "F" 89 90 90 "M"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 17:52:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/653908#M196421</guid>
      <dc:creator>Naveen1111</dc:creator>
      <dc:date>2020-06-06T17:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: full join in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/653917#M196424</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/327047"&gt;@Naveen1111&lt;/a&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SQL JOIN Thumb rule : N*M values --&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;So will the below make sense&lt;/P&gt;
&lt;TABLE width="217"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;abc_data&lt;/TD&gt;
&lt;TD width="71"&gt;qwe_data&lt;/TD&gt;
&lt;TD width="82"&gt;Relationship&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;c&lt;/TD&gt;
&lt;TD width="71"&gt;c&lt;/TD&gt;
&lt;TD&gt;Notes&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;30&lt;/TD&gt;
&lt;TD width="71"&gt;30&lt;/TD&gt;
&lt;TD&gt;One to one&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;&lt;STRONG&gt;90&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="71"&gt;&lt;STRONG&gt;90&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;STRONG&gt;One to many&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="71"&gt;&lt;STRONG&gt;90&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;STRONG&gt;One to many&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Sat, 06 Jun 2020 18:17:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/653917#M196424</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-06-06T18:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: full join in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/653918#M196425</link>
      <description>&lt;P&gt;You have one match for c=30, and two matches for c=90, so you get three observations in the result. If you want only two, you need to deduplicate dataset qwe.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 18:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/653918#M196425</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-06T18:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: full join in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/654009#M196459</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for ur support!&lt;/P&gt;&lt;P&gt;Could you tell me how can I further deduplicate it (as per my knowledge full join combines the result of both left and right outer join)&lt;/P&gt;&lt;P&gt;Also, please help me with the sequence/order of SQL syntax as I tried to execute the below program, but it didn't work .&lt;/P&gt;&lt;P&gt;Need to know where should I terminate each statement and in which order, should I use order by syntax first or group by or where condition?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table ph as select* from sashelp.class&lt;BR /&gt;where age&amp;gt;14 order by weight desc group by sex;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jun 2020 13:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/654009#M196459</guid>
      <dc:creator>Naveen1111</dc:creator>
      <dc:date>2020-06-07T13:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: full join in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/654059#M196471</link>
      <description>&lt;P&gt;Given your data as posted, a distinct should do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select distinct
  a.*,&lt;BR /&gt;  q.q,&lt;BR /&gt;  q.w,&lt;BR /&gt;  q.c as c_q,&lt;BR /&gt;  q.e
from abc a
full join
qwe q
on a.c = q.c
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;"Did not work" is worthy of the proverbial blonde secretary. Supply the log, and describe in detail where the result did not meet your expectactions.&lt;/P&gt;
&lt;P&gt;The most obvious problem is the missing blank between select and the asterisk. Also do not use the asterisk like this in joins, or you'll get WARNINGs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jun 2020 20:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/full-join-in-proc-sql/m-p/654059#M196471</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-07T20:00:13Z</dc:date>
    </item>
  </channel>
</rss>

