<?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: Inner join two dataset matching columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349748#M81203</link>
    <description>&lt;P&gt;Thank you so much for your help. &amp;nbsp;My error was that I did not rename the dataset in the second variables. &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Apr 2017 13:02:53 GMT</pubDate>
    <dc:creator>thb</dc:creator>
    <dc:date>2017-04-13T13:02:53Z</dc:date>
    <item>
      <title>Inner join two dataset matching columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349658#M81151</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to join two data sets with the same columns, but only if they have the same IDNumbers and Name. &amp;nbsp;Data1 has Q3 data and Data 2 has Q4 data. &amp;nbsp;I only want to merge the data if there's at least one month of data for each IDNumber and Name in BOTH Q3 and Q4 datasets. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variables are the same in both datasets - the only difference is the StartDate.&lt;/P&gt;&lt;P&gt;Variables = IDNumbers, Name, Numerator, Denominator, StartDate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Proc Sql, but the merged dataset only includes data from Data1 (Q3). &amp;nbsp;I'm not sure what I'm doing incorrectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql;
CREATE TABLE Merge 
AS SELECT a.*, b*
FROM Dataset1 a 
INNER JOIN Dataset2 b
ON a.IDNumbers=b.IDNumbers AND a.Name=b.NAME
ORDER BY StartDate;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 04:09:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349658#M81151</guid>
      <dc:creator>thb</dc:creator>
      <dc:date>2017-04-13T04:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join two dataset matching columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349659#M81152</link>
      <description>&lt;P&gt;You probably should post some example data to better explain what you want to happen.&lt;/P&gt;
&lt;P&gt;But if you want the results to include records with no matches then you probably need to use FULL JOIN instead of INNER JOIN.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 04:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349659#M81152</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-04-13T04:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join two dataset matching columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349668#M81153</link>
      <description>&lt;P&gt;If the variables are the same doesn't your code have errors? What does the log show? You should have to rename the columns since you can't have variables with the same name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your criteria is more complex than&amp;nbsp;a single join and you may actually want an append/concatenation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Tom has indicated, you do need to include sample data&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 05:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349668#M81153</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-13T05:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join two dataset matching columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349680#M81157</link>
      <description>&lt;P&gt;A reasonable guess:&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&lt;/P&gt;
&lt;P&gt;select a.*, b.StartDate as StartDate2&lt;/P&gt;
&lt;P&gt;from Dataset1 a, Dataset2 b&lt;/P&gt;
&lt;P&gt;where a.IDNumbers = b.IDNumbers and a.Name = b.Name&lt;/P&gt;
&lt;P&gt;order by StartDate;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 06:33:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349680#M81157</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-13T06:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join two dataset matching columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349748#M81203</link>
      <description>&lt;P&gt;Thank you so much for your help. &amp;nbsp;My error was that I did not rename the dataset in the second variables. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 13:02:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inner-join-two-dataset-matching-columns/m-p/349748#M81203</guid>
      <dc:creator>thb</dc:creator>
      <dc:date>2017-04-13T13:02:53Z</dc:date>
    </item>
  </channel>
</rss>

