<?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: combining datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267037#M52723</link>
    <description>&lt;P&gt;While I normally prefer a DATA step solution, note that you can simplify the SQL solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table want as select * from a, b;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Apr 2016 16:59:05 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-04-28T16:59:05Z</dc:date>
    <item>
      <title>combining datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267026#M52717</link>
      <description>&lt;P&gt;i have two small data sets a &amp;amp; b. a has 1 variable and nine observations.&amp;nbsp; b has 5 variables and 1 observation. there are no commonalities between the two data sets. how can i combine the two datasets to produce a new dataset c with six variables and 9 observations? by the way i am olorire.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 16:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267026#M52717</guid>
      <dc:creator>olorire</dc:creator>
      <dc:date>2016-04-28T16:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: combining datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267030#M52719</link>
      <description>&lt;P&gt;Please provide sample data and desired output.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 16:24:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267030#M52719</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2016-04-28T16:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: combining datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267031#M52720</link>
      <description>&lt;P&gt;It depends on how you want the values of the variables resulting. If the values from the one observation set are to only appear once then you can use a data step merge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; merge a b;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want all of the obeservations to have the values from the one observation set then you would want an SQL cartesian (fancy work everything in one set&amp;nbsp;combined with everything in the other) join.&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; create table want as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; select a.*, b.*&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; from a join b;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 16:28:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267031#M52720</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-28T16:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: combining datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267035#M52722</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/81959"&gt;@olorire﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would this example match your&amp;nbsp;intention?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create test datasets */

data a;
do i=1 to 9;
  output;
end;
run;

data b;
array x[5] (11:15);
run;

/* Combine the two datasets */

data want;
set a;
if _n_=1 then set b;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw﻿&lt;/a&gt;: Did you mean "from a &lt;STRONG&gt;cross&lt;/STRONG&gt; join b;" (or shorter: &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;from a,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;b;")&lt;/SPAN&gt;&amp;nbsp;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 16:39:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267035#M52722</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-28T16:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: combining datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267037#M52723</link>
      <description>&lt;P&gt;While I normally prefer a DATA step solution, note that you can simplify the SQL solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table want as select * from a, b;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 16:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/267037#M52723</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-04-28T16:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: combining datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/268208#M53070</link>
      <description>&lt;P&gt;Thanks. I have opted for the sql solution although I'm still a rookie as far as that proc is concerned.&lt;/P&gt;&lt;P&gt;olorire&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2016 08:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/268208#M53070</guid>
      <dc:creator>olorire</dc:creator>
      <dc:date>2016-05-04T08:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: combining datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/268209#M53071</link>
      <description>&lt;P&gt;Thank you very much. Your coding is appropriate and straightforward.&lt;/P&gt;&lt;P&gt;olorire&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2016 08:18:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/268209#M53071</guid>
      <dc:creator>olorire</dc:creator>
      <dc:date>2016-05-04T08:18:44Z</dc:date>
    </item>
  </channel>
</rss>

