<?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: Merging datasets without common variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-datasets-without-common-variables/m-p/51944#M10936</link>
    <description>How simple can it be?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help!</description>
    <pubDate>Tue, 07 Oct 2008 05:38:50 GMT</pubDate>
    <dc:creator>Rik</dc:creator>
    <dc:date>2008-10-07T05:38:50Z</dc:date>
    <item>
      <title>Merging datasets without common variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-datasets-without-common-variables/m-p/51942#M10934</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I want to create a dataset with information coming out of multiple datasets  Let me try to explain with an example;&lt;BR /&gt;
&lt;BR /&gt;
Data ONE;&lt;BR /&gt;
   infile cards;&lt;BR /&gt;
   attrib COUNTRY          length=$20 label='Country';&lt;BR /&gt;
input country;&lt;BR /&gt;
cards;&lt;BR /&gt;
Belgium&lt;BR /&gt;
France&lt;BR /&gt;
Germany&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
Data TWO;&lt;BR /&gt;
   infile cards;&lt;BR /&gt;
   attrib STOCK          length=$20 label='Stock';&lt;BR /&gt;
input country;&lt;BR /&gt;
cards;&lt;BR /&gt;
Stock1&lt;BR /&gt;
Stock2&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
Data THREE;&lt;BR /&gt;
   infile cards;&lt;BR /&gt;
   attrib PRODUCT          length=$20 label='Product';&lt;BR /&gt;
input country;&lt;BR /&gt;
cards;&lt;BR /&gt;
Product1&lt;BR /&gt;
Product2&lt;BR /&gt;
;&lt;BR /&gt;
Run;&lt;BR /&gt;
&lt;BR /&gt;
Now I want to create a dataset with all possible combinations of the above data set. This should look like this.&lt;BR /&gt;
COUNTRY            STOCK             PRODUCT&lt;BR /&gt;
---------------             -------------           ----------------&lt;BR /&gt;
Belgium                Stock1             Product1&lt;BR /&gt;
Belgium                Stock1             Product2&lt;BR /&gt;
Belgium                Stock2             Product1&lt;BR /&gt;
Belgium                Stock2             Product2&lt;BR /&gt;
France                  Stock1             Product1&lt;BR /&gt;
France                  Stock1             Product2&lt;BR /&gt;
France                  Stock2             Product1&lt;BR /&gt;
France                  Stock2             Product2&lt;BR /&gt;
Germany               Stock1             Product1&lt;BR /&gt;
Germany               Stock1             Product2&lt;BR /&gt;
Germany               Stock2             Product1&lt;BR /&gt;
Germany               Stock2             Product2&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Not sure how to handle this.&lt;BR /&gt;
Any suggestions?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Mon, 06 Oct 2008 06:56:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-datasets-without-common-variables/m-p/51942#M10934</guid>
      <dc:creator>Rik</dc:creator>
      <dc:date>2008-10-06T06:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Merging datasets without common variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-datasets-without-common-variables/m-p/51943#M10935</link>
      <description>What you want is a cartesian product. That's easiest done with SQL:&lt;BR /&gt;
&lt;BR /&gt;
Data ONE;&lt;BR /&gt;
infile cards;&lt;BR /&gt;
attrib COUNTRY length=$20 label='Country';&lt;BR /&gt;
input country;&lt;BR /&gt;
cards;&lt;BR /&gt;
Belgium&lt;BR /&gt;
France&lt;BR /&gt;
Germany&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
Data TWO;&lt;BR /&gt;
infile cards;&lt;BR /&gt;
attrib STOCK length=$20 label='Stock';&lt;BR /&gt;
input STOCK;&lt;BR /&gt;
cards;&lt;BR /&gt;
Stock1&lt;BR /&gt;
Stock2&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
Data THREE;&lt;BR /&gt;
infile cards;&lt;BR /&gt;
attrib PRODUCT length=$20 label='Product';&lt;BR /&gt;
input PRODUCT;&lt;BR /&gt;
cards;&lt;BR /&gt;
Product1&lt;BR /&gt;
Product2&lt;BR /&gt;
;&lt;BR /&gt;
Run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select *&lt;BR /&gt;
    from THREE,(select * from one ,two)&lt;BR /&gt;
  ;&lt;BR /&gt;
quit;</description>
      <pubDate>Mon, 06 Oct 2008 07:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-datasets-without-common-variables/m-p/51943#M10935</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2008-10-06T07:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Merging datasets without common variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-datasets-without-common-variables/m-p/51944#M10936</link>
      <description>How simple can it be?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help!</description>
      <pubDate>Tue, 07 Oct 2008 05:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-datasets-without-common-variables/m-p/51944#M10936</guid>
      <dc:creator>Rik</dc:creator>
      <dc:date>2008-10-07T05:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Merging datasets without common variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-datasets-without-common-variables/m-p/51945#M10937</link>
      <description>proc sql;&lt;BR /&gt;
select * from one,two,three;&lt;BR /&gt;
quit;</description>
      <pubDate>Tue, 07 Oct 2008 09:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-datasets-without-common-variables/m-p/51945#M10937</guid>
      <dc:creator>Pavan_SAS</dc:creator>
      <dc:date>2008-10-07T09:04:56Z</dc:date>
    </item>
  </channel>
</rss>

