<?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: DI Studio - union - How to product separate select statements in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-union-How-to-product-separate-select-statements/m-p/771065#M20110</link>
    <description>&lt;P&gt;The SQL JOIN Transformation lets you define a UNION JOIN. This is NOT the same like a UNION set operation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer to the discussion &lt;A href="https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-UNION/td-p/425178" target="_self"&gt;here&lt;/A&gt; and the links provided in the answer marked as solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really want to go for a UNION JOIN configure your SQL Transformation in a way so it creates code as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select distinct
  coalesce(l.name,r.name) as name 
from 
  employee l 
  union join
  prospect r
where l.dept = 'abc' or r.city = 'denver'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively - and easier to setup and maintain imho - use the SQL Set transformation and create a VIEW as target. Then use this view in your SQL Transformation.&lt;/P&gt;
&lt;P&gt;This way the SQL Set generated logic will only get executed as part of the code generated by your SQL Join transformation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Oct 2021 00:38:45 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2021-10-05T00:38:45Z</dc:date>
    <item>
      <title>DI Studio - union - How to product separate select statements</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-union-How-to-product-separate-select-statements/m-p/771054#M20109</link>
      <description>&lt;P&gt;This has been raised previously, marked as solved, but really wasn't.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SAS DI join transformation has a union option.&amp;nbsp; This should allow multiple selections and where clauses to produce a single result.&amp;nbsp; I can find no way to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I want a list of distinct names from two tables the SQL it should produce would look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Select name from employee where dept = 'abc'&lt;/P&gt;&lt;P&gt;union&lt;/P&gt;&lt;P&gt;select name from prospect where city = 'denver'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It only allows one map, one select, and one where clause.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't really want to use the set operator as I then want this to be a sub-query in the join transformation, not separate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do this?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 01:40:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-union-How-to-product-separate-select-statements/m-p/771054#M20109</guid>
      <dc:creator>duaneep1</dc:creator>
      <dc:date>2021-09-29T01:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - union - How to product separate select statements</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-union-How-to-product-separate-select-statements/m-p/771065#M20110</link>
      <description>&lt;P&gt;The SQL JOIN Transformation lets you define a UNION JOIN. This is NOT the same like a UNION set operation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer to the discussion &lt;A href="https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-UNION/td-p/425178" target="_self"&gt;here&lt;/A&gt; and the links provided in the answer marked as solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really want to go for a UNION JOIN configure your SQL Transformation in a way so it creates code as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select distinct
  coalesce(l.name,r.name) as name 
from 
  employee l 
  union join
  prospect r
where l.dept = 'abc' or r.city = 'denver'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively - and easier to setup and maintain imho - use the SQL Set transformation and create a VIEW as target. Then use this view in your SQL Transformation.&lt;/P&gt;
&lt;P&gt;This way the SQL Set generated logic will only get executed as part of the code generated by your SQL Join transformation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 00:38:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-union-How-to-product-separate-select-statements/m-p/771065#M20110</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-10-05T00:38:45Z</dc:date>
    </item>
  </channel>
</rss>

