<?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 : Outer union corr in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/280117#M59025</link>
    <description>&lt;P&gt;Run below code. That will hopefully explain it to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
  attrib 
    A length=8
    b length=8;
  A=1;
  B=1;
run;
data have2;
  attrib 
    A length= 8
    B length= $20;
  A=2;
  B='2';
run;

/* throws an error because column B is of different type in source tables  */
/* error indicates which column based on variable number causes the issue  */
/* running proc contents over source tables will return the variable names with attributs */
/*   so the problematic column is easily identified                        */
proc sql;
  create table demo1 as
  select *
  from have1
  outer union corresponding
  select *
  from have2
  ;
quit;

/* will work */
proc sql;
  create table demo1 as
  select a, b as b1
  from have1
  outer union corresponding
  select a, b as b2
  from have2
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 25 Jun 2016 06:35:53 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2016-06-25T06:35:53Z</dc:date>
    <item>
      <title>proc sql : Outer union corr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/40716#M10524</link>
      <description>I need to concatenate two data sets using outer union corr. But these two datasets have different number of variables&lt;BR /&gt;
&lt;BR /&gt;
WORK.READXTRAN has 196955 observations and 264 variables&lt;BR /&gt;
WORK.READXTRAO has 1012170 observations and 245 variables&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to do:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 Create table readxtra as &lt;BR /&gt;
 select *&lt;BR /&gt;
 from readxtraN &lt;BR /&gt;
 OUTER UNION CORRESPONDING&lt;BR /&gt;
 select * &lt;BR /&gt;
 from readxtraO;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I get an error: ERROR: Column 203 from the first contributor of OUTER UNION is not the same type as its counterpart&lt;BR /&gt;
&lt;BR /&gt;
Please suggest how I should contenate these two datasets using proc sql?</description>
      <pubDate>Thu, 14 Jan 2010 17:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/40716#M10524</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-14T17:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql : Outer union corr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/40717#M10525</link>
      <description>you'll need to rename that column, and any others which have different datatypes for the same name.&lt;BR /&gt;
The message indicates its number not its name, but PROC CONTENTS will provide the numbers.</description>
      <pubDate>Sat, 16 Jan 2010 13:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/40717#M10525</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-01-16T13:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql : Outer union corr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/279981#M59015</link>
      <description>&lt;P&gt;Can someone elaborate on this? I am having the same issue, but I don't understand the solution here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you mean rename the column? Just name the variable name?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a number of these errors! Does that mean I have to rename every single column? What do I rename them to?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 13:37:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/279981#M59015</guid>
      <dc:creator>christinagting0</dc:creator>
      <dc:date>2016-06-24T13:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql : Outer union corr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/280117#M59025</link>
      <description>&lt;P&gt;Run below code. That will hopefully explain it to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
  attrib 
    A length=8
    b length=8;
  A=1;
  B=1;
run;
data have2;
  attrib 
    A length= 8
    B length= $20;
  A=2;
  B='2';
run;

/* throws an error because column B is of different type in source tables  */
/* error indicates which column based on variable number causes the issue  */
/* running proc contents over source tables will return the variable names with attributs */
/*   so the problematic column is easily identified                        */
proc sql;
  create table demo1 as
  select *
  from have1
  outer union corresponding
  select *
  from have2
  ;
quit;

/* will work */
proc sql;
  create table demo1 as
  select a, b as b1
  from have1
  outer union corresponding
  select a, b as b2
  from have2
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Jun 2016 06:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/280117#M59025</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-06-25T06:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql : Outer union corr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/280230#M59033</link>
      <description>&lt;P&gt;Thanks Patrick for taking the time to post the example. It really does help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question though.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I notice that the correct proc sql code renames variables b to b1 from dataset have 1, &amp;nbsp;and then renames b to b2 from dataset 2. But for the merging of the two datasets I want b1 and b2 to be in the same column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data set have 1 has variables a and b&lt;/P&gt;&lt;P&gt;data set have 2 has variables a and b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;final merged data set has variables a and b which contains the data points from variables a and b from dataset have 1 and have2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jun 2016 16:59:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-Outer-union-corr/m-p/280230#M59033</guid>
      <dc:creator>christinagting0</dc:creator>
      <dc:date>2016-06-26T16:59:48Z</dc:date>
    </item>
  </channel>
</rss>

