<?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: about   proc with  outer union in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52003#M14294</link>
    <description>Scott is right, I deliberately didn't mention what would happen if you used CREATE TABLE syntax with your PROC SQL query. A TABLE created from your query would net slightly different results than just the printed display from running a query. Depending on what you want to do, you might really want a join instead of a union.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
    <pubDate>Sat, 17 Jul 2010 21:10:34 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2010-07-17T21:10:34Z</dc:date>
    <item>
      <title>about   proc with  outer union</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52000#M14291</link>
      <description>hi guys , &lt;BR /&gt;
I have question about using proc sql with outer union : &lt;BR /&gt;
This is my code : &lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
input  x  y $ ;&lt;BR /&gt;
cards;&lt;BR /&gt;
1  one     &lt;BR /&gt;
2  two     &lt;BR /&gt;
2  two     &lt;BR /&gt;
3  three   &lt;BR /&gt;
;&lt;BR /&gt;
data b;&lt;BR /&gt;
input x z $ ;&lt;BR /&gt;
cards;&lt;BR /&gt;
1  one     &lt;BR /&gt;
2  two     &lt;BR /&gt;
4  four    &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
   create table both1 as&lt;BR /&gt;
   select * from a outer union  &lt;BR /&gt;
   select * from b;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
According to the link :&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a001361224.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a001361224.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
column x would appear twice in  dataset both1 , however when I run the code it only appears once. So there are 3 columns only instead of 4 columns.

Message was edited by: jack050</description>
      <pubDate>Sat, 17 Jul 2010 19:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52000#M14291</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-17T19:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: about   proc with  outer union</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52001#M14292</link>
      <description>Hi:&lt;BR /&gt;
  There &lt;B&gt;&lt;U&gt;is&lt;/U&gt;&lt;/B&gt;&lt;U&gt;&lt;/U&gt; a difference between outer union and outer union corr. If I run the code on the documentation page, I get the same results as those shown in the doc.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
              &lt;BR /&gt;
[pre]&lt;BR /&gt;
data a;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input x y $;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1  one     &lt;BR /&gt;
2  two     &lt;BR /&gt;
2  two     &lt;BR /&gt;
3  three   &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                     &lt;BR /&gt;
data b;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input x z $;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1  one     &lt;BR /&gt;
2  two     &lt;BR /&gt;
4  four    &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
ods listing;&lt;BR /&gt;
options nocenter;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
   title '1) A OUTER UNION B';&lt;BR /&gt;
   select * from work.a&lt;BR /&gt;
   outer union&lt;BR /&gt;
   select * from work.b;&lt;BR /&gt;
quit;&lt;BR /&gt;
                       &lt;BR /&gt;
proc sql;&lt;BR /&gt;
   title '2) A OUTER UNION CORR B';&lt;BR /&gt;
   select * from work.a&lt;BR /&gt;
   outer union corresponding&lt;BR /&gt;
   select * from work.b;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Output (note that I DO get two X columns for OUTER UNION method -- versus only one X column for OUTER UNION CORR):&lt;BR /&gt;
[pre]&lt;BR /&gt;
1) A OUTER UNION B&lt;BR /&gt;
                       &lt;BR /&gt;
       x  y                x  z&lt;BR /&gt;
--------------------------------------&lt;BR /&gt;
       1  one              .&lt;BR /&gt;
       2  two              .&lt;BR /&gt;
       2  two              .&lt;BR /&gt;
       3  three            .&lt;BR /&gt;
       .                   1  one&lt;BR /&gt;
       .                   2  two&lt;BR /&gt;
       .                   4  four&lt;BR /&gt;
&lt;BR /&gt;
                         &lt;BR /&gt;
                                  &lt;BR /&gt;
2) A OUTER UNION CORR B&lt;BR /&gt;
                                   &lt;BR /&gt;
       x  y         z&lt;BR /&gt;
----------------------------&lt;BR /&gt;
       1  one&lt;BR /&gt;
       2  two&lt;BR /&gt;
       2  two&lt;BR /&gt;
       3  three&lt;BR /&gt;
       1            one&lt;BR /&gt;
       2            two&lt;BR /&gt;
       4            four&lt;BR /&gt;
[/pre]</description>
      <pubDate>Sat, 17 Jul 2010 19:47:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52001#M14292</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-07-17T19:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: about   proc with  outer union</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52002#M14293</link>
      <description>SAS is not going to create a new variable for you.  Each SAS table/member can have only one occurence of a named column/variable.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a001361224.htm#a001361227" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a001361224.htm#a001361227&lt;/A&gt;</description>
      <pubDate>Sat, 17 Jul 2010 19:51:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52002#M14293</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-17T19:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: about   proc with  outer union</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52003#M14294</link>
      <description>Scott is right, I deliberately didn't mention what would happen if you used CREATE TABLE syntax with your PROC SQL query. A TABLE created from your query would net slightly different results than just the printed display from running a query. Depending on what you want to do, you might really want a join instead of a union.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Sat, 17 Jul 2010 21:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52003#M14294</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-07-17T21:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: about   proc with  outer union</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52004#M14295</link>
      <description>thanks for pointing that out guys , I totally overlooked that the data set and query results are different</description>
      <pubDate>Sun, 18 Jul 2010 03:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-proc-with-outer-union/m-p/52004#M14295</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-18T03:34:02Z</dc:date>
    </item>
  </channel>
</rss>

