<?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: Union on SAS VA in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Union-on-SAS-VA/m-p/238960#M2914</link>
    <description>&lt;P&gt;Hi Ajay,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did some more research to see how we can get this to work, and it looks like the only way would be for you to modify the code directly. Here are some options and what the results would looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4"&gt;&amp;nbsp;For example:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data cars;
  keep Petrol Diesel;
  merge sashelp.cars (where=(Origin='Asia') obs=5
        rename=(Model=Diesel))
        sashelp.cars (where=(Origin='Europe')obs=8
        rename=(Model=Petrol));
run;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Example original dataset:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1152i76FA1681734A46F8/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Dataset.png" title="Dataset.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;------------------------------------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Option 1:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc ds2;
TITLE 'Using DS2';
data;
  method run();
  set {select * from
  cars
  full join
  (select Petrol as AllCars
    from cars
    union all
    select Diesel from cars
    ) as a
  on cars.Petrol=a.AllCars};
  if not missing(cat(Petrol,Diesel,Allcars));
  end;
enddata;
run;
quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Option 1 results:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1153i6BBF777366925EE7/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Ds2 Example.png" title="Ds2 Example.png" /&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;----------------------------------------------------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Option 2:&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
TITLE 'Using PROC SQL';
select * from
  cars
  full join
  (select Petrol as AllCars
    from cars
    union all
    select Diesel from cars
    ) as a
  on cars.Petrol=a.AllCars
  where cats(Petrol,Diesel,Allcars) is not null
;
quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Option 2&amp;nbsp;results:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1154i07C665169E250EFD/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="ProcSQL Example.png" title="ProcSQL Example.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the case that you wanted to have the data union appear in a seperate table (instead of combined with the original columns), the answer is a lot more straightforward. You would go to the data builder and click &lt;STRONG&gt;LASR&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Append Tables &lt;/STRONG&gt;to get started. Here is a link to more detailed information about appending tables:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/vaug/68648/HTML/default/viewer.htm#n10uk49nxnzpmcn0zp4na9bn261v.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/vaug/68648/HTML/default/viewer.htm#n10uk49nxnzpmcn0zp4na9bn261v.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Lorrie&lt;/P&gt;</description>
    <pubDate>Fri, 11 Dec 2015 18:49:54 GMT</pubDate>
    <dc:creator>Lorrie_SAS</dc:creator>
    <dc:date>2015-12-11T18:49:54Z</dc:date>
    <item>
      <title>Union on SAS VA</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Union-on-SAS-VA/m-p/238262#M2885</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am having some challenge to do the following in SAS VA i.e, to generate MycarTable from CarTable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1083i84AB316F3DAEBE88/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="TemporaryTableWithColumnsCombined.png" title="TemporaryTableWithColumnsCombined.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please guide me how to create a table(MyCarTable) with original columns and a new column that is a union of first two columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Ajay&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 14:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Union-on-SAS-VA/m-p/238262#M2885</guid>
      <dc:creator>vasireddyajay</dc:creator>
      <dc:date>2015-12-08T14:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Union on SAS VA</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Union-on-SAS-VA/m-p/238313#M2886</link>
      <description>&lt;P&gt;Hi Ajay,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From&amp;nbsp;the Visual Data Builder, try creating a data query and adding your table. After you add the existing columns by clicking on the names, create a new column by clicking the plus sign (+) on the Column Editor tab,&amp;nbsp;and then create a union expression for the new column. Here's some documentation that may be helpful:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/vaug/68648/HTML/default/viewer.htm#n0bk4cm9klgbh3n1jxpb8lfxu12p.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/vaug/68648/HTML/default/viewer.htm#n0bk4cm9klgbh3n1jxpb8lfxu12p.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Lorrie&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 15:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Union-on-SAS-VA/m-p/238313#M2886</guid>
      <dc:creator>Lorrie_SAS</dc:creator>
      <dc:date>2015-12-08T15:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Union on SAS VA</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Union-on-SAS-VA/m-p/238318#M2887</link>
      <description>Hi Lorrie,&lt;BR /&gt;&lt;BR /&gt;thank you for your comment. I tried to use the (+) but when I try to use select statement, in the expression, I am getting exceptions. Could you please let me know the expression you used to create a new column that joins the columns from the same table.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;Ajay</description>
      <pubDate>Tue, 08 Dec 2015 16:08:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Union-on-SAS-VA/m-p/238318#M2887</guid>
      <dc:creator>vasireddyajay</dc:creator>
      <dc:date>2015-12-08T16:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Union on SAS VA</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Union-on-SAS-VA/m-p/238960#M2914</link>
      <description>&lt;P&gt;Hi Ajay,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did some more research to see how we can get this to work, and it looks like the only way would be for you to modify the code directly. Here are some options and what the results would looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4"&gt;&amp;nbsp;For example:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data cars;
  keep Petrol Diesel;
  merge sashelp.cars (where=(Origin='Asia') obs=5
        rename=(Model=Diesel))
        sashelp.cars (where=(Origin='Europe')obs=8
        rename=(Model=Petrol));
run;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Example original dataset:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1152i76FA1681734A46F8/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Dataset.png" title="Dataset.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;------------------------------------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Option 1:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc ds2;
TITLE 'Using DS2';
data;
  method run();
  set {select * from
  cars
  full join
  (select Petrol as AllCars
    from cars
    union all
    select Diesel from cars
    ) as a
  on cars.Petrol=a.AllCars};
  if not missing(cat(Petrol,Diesel,Allcars));
  end;
enddata;
run;
quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Option 1 results:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1153i6BBF777366925EE7/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Ds2 Example.png" title="Ds2 Example.png" /&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;----------------------------------------------------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Option 2:&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
TITLE 'Using PROC SQL';
select * from
  cars
  full join
  (select Petrol as AllCars
    from cars
    union all
    select Diesel from cars
    ) as a
  on cars.Petrol=a.AllCars
  where cats(Petrol,Diesel,Allcars) is not null
;
quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Option 2&amp;nbsp;results:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1154i07C665169E250EFD/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="ProcSQL Example.png" title="ProcSQL Example.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the case that you wanted to have the data union appear in a seperate table (instead of combined with the original columns), the answer is a lot more straightforward. You would go to the data builder and click &lt;STRONG&gt;LASR&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Append Tables &lt;/STRONG&gt;to get started. Here is a link to more detailed information about appending tables:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/vaug/68648/HTML/default/viewer.htm#n10uk49nxnzpmcn0zp4na9bn261v.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/vaug/68648/HTML/default/viewer.htm#n10uk49nxnzpmcn0zp4na9bn261v.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Lorrie&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 18:49:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Union-on-SAS-VA/m-p/238960#M2914</guid>
      <dc:creator>Lorrie_SAS</dc:creator>
      <dc:date>2015-12-11T18:49:54Z</dc:date>
    </item>
  </channel>
</rss>

