<?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 with multiple condition? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-with-multiple-condition/m-p/719014#M222560</link>
    <description>&lt;P&gt;There are many syntax errors in your sql code.&lt;/P&gt;
&lt;P&gt;Compare it to next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
	Create table innerjoin_ as
	Select x.*,
	       y.del_exc_rat,
		   y.lagcogs,
		   y.lagsel_gen_adm,
		   y.lagope_lea_exp, 
		   y.lagr_and_d,
		   y.laggoodwill
	from winsed.merge_treat_con as x
	inner join 	work._9blag	as y	
	on x.year=y.year and x.Type = y.Type;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 12 Feb 2021 21:09:51 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2021-02-12T21:09:51Z</dc:date>
    <item>
      <title>Inner join with multiple condition?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-with-multiple-condition/m-p/719004#M222550</link>
      <description>&lt;P&gt;Hi SAS Users,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Today I tried to inner join two datasets "&lt;STRONG&gt;winsed.merge_treat_con&lt;/STRONG&gt;" and "&lt;STRONG&gt;_9b_lag&lt;/STRONG&gt;" based on two variables "&lt;STRONG&gt;Year&lt;/STRONG&gt;" and "&lt;STRONG&gt;Type&lt;/STRONG&gt;" (both are character variables)&lt;/P&gt;
&lt;P&gt;In the joined dataset, I want to have all variables of the &lt;STRONG&gt;winsed.merge_treat_con&lt;/STRONG&gt; and these variables &lt;STRONG&gt;del_exc_rat, lagcogs, lagsel_gen_adm, lagope_lea_exp,&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;lagr_and_d, laggoodwill&lt;/STRONG&gt; from&amp;nbsp;&lt;STRONG&gt;_9b_lag&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code based on one condition is as below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
Create table innerjoin_ as
Select * from winsed.merge_treat_con as x, del_exc_rat lagcogs lagsel_gen_adm lagope_lea_exp 
		lagr_and_d laggoodwill from _9b_lag	as y
where x.Type = y.Type;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am not sure how can I deal with two conditions and apart from Proc SQL, and whether we can use other ways to merge inner join like that (because sometimes SQL consumes quite a bit of ram).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks and warm regards.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 20:42:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inner-join-with-multiple-condition/m-p/719004#M222550</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-12T20:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join with multiple condition?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-with-multiple-condition/m-p/719009#M222555</link>
      <description>&lt;P&gt;it sounds this might be what you are after&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
Create table innerjoin_ as
Select 
	x.*
	, del_exc_rat 
	, lagcogs 
	, lagsel_gen_adm 
	, lagope_lea_exp 
	, lagr_and_d 
	, laggoodwill
from 
	winsed.merge_treat_con as x
	INNER JOIN _9b_lag	as y ON x.Type = y.Type;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Feb 2021 20:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inner-join-with-multiple-condition/m-p/719009#M222555</guid>
      <dc:creator>utrocketeng</dc:creator>
      <dc:date>2021-02-12T20:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join with multiple condition?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-with-multiple-condition/m-p/719013#M222559</link>
      <description>&lt;P&gt;... or if you need two conditions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;.... ON x.Type = y.Type AND x.Year = y.Year&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 21:07:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inner-join-with-multiple-condition/m-p/719013#M222559</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-02-12T21:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Inner join with multiple condition?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Inner-join-with-multiple-condition/m-p/719014#M222560</link>
      <description>&lt;P&gt;There are many syntax errors in your sql code.&lt;/P&gt;
&lt;P&gt;Compare it to next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
	Create table innerjoin_ as
	Select x.*,
	       y.del_exc_rat,
		   y.lagcogs,
		   y.lagsel_gen_adm,
		   y.lagope_lea_exp, 
		   y.lagr_and_d,
		   y.laggoodwill
	from winsed.merge_treat_con as x
	inner join 	work._9blag	as y	
	on x.year=y.year and x.Type = y.Type;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Feb 2021 21:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Inner-join-with-multiple-condition/m-p/719014#M222560</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-12T21:09:51Z</dc:date>
    </item>
  </channel>
</rss>

