<?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 two datasets without a common by variable in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Merging-two-datasets-without-a-common-by-variable/m-p/215202#M5191</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a standard task for SQL:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;create table three as&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select one.*, two.pho&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;from one natural join two;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 01 Aug 2015 03:31:51 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2015-08-01T03:31:51Z</dc:date>
    <item>
      <title>Merging two datasets without a common by variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Merging-two-datasets-without-a-common-by-variable/m-p/215201#M5190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first dataset (one) represents people (pid) and where they live (cid). The second data set (two) has where they live (cid) and a set of possible product choices (pho). I need a dataset that has, for each person, all the choices they face.&amp;nbsp; Note: the choice set changes based on where they live.&amp;nbsp; The below illustrates my issue.&amp;nbsp; The actual data has 90,000 persons living in 180 different locations that on average will have 20 choices.&amp;nbsp; The output data file will have approx. 1,800,000 obs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data one; input pid cid;&lt;BR /&gt; datalines;&lt;BR /&gt; 1 1&lt;BR /&gt; 2 1&lt;BR /&gt; 3 1&lt;BR /&gt; 4 2&lt;BR /&gt; 5 2&lt;BR /&gt; ;&lt;BR /&gt; data two; input cid pho;&lt;BR /&gt; datalines;&lt;BR /&gt; 1 1&lt;BR /&gt; 1 2&lt;BR /&gt; 1 3&lt;BR /&gt; 1 4&lt;BR /&gt; 2 1&lt;BR /&gt; 2 4&lt;BR /&gt; 2 5&lt;BR /&gt; ; &lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; needed output&lt;BR /&gt; pid cid pho&lt;BR /&gt; &lt;SPAN style="color: #00ff00;"&gt;1 1 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #00ff00;"&gt; 1 1 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #00ff00;"&gt; 1 1 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #00ff00;"&gt; 1 1 4&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #00ffff;"&gt;2 1 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #00ffff;"&gt; 2 1 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #00ffff;"&gt; 2 1 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #00ffff;"&gt; 2 1 4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff00ff;"&gt; 3 1 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff00ff;"&gt; 3 1 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff00ff;"&gt; 3 1 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff00ff;"&gt; 3 1 4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff;"&gt; 4 2 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff;"&gt; 4 2 4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff;"&gt; 4 2 5&lt;/SPAN&gt;&lt;BR /&gt; 5 2 1&lt;BR /&gt; 5 2 4&lt;BR /&gt; 5 2 5&lt;BR /&gt; */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2015 20:48:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Merging-two-datasets-without-a-common-by-variable/m-p/215201#M5190</guid>
      <dc:creator>MichaelWku</dc:creator>
      <dc:date>2015-07-31T20:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two datasets without a common by variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Merging-two-datasets-without-a-common-by-variable/m-p/215202#M5191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a standard task for SQL:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;create table three as&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select one.*, two.pho&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;from one natural join two;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Aug 2015 03:31:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Merging-two-datasets-without-a-common-by-variable/m-p/215202#M5191</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-08-01T03:31:51Z</dc:date>
    </item>
  </channel>
</rss>

