<?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: Joins in Macro application in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702486#M215165</link>
    <description>&lt;OL&gt;
&lt;LI&gt;Post logs as text, &lt;STRONG&gt;NOT&lt;/STRONG&gt; as pictures!!&lt;/LI&gt;
&lt;LI&gt;The problem is &lt;STRONG&gt;PAINFULLY&lt;/STRONG&gt; obvious, please use your own brain for once.&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Mon, 30 Nov 2020 12:33:21 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-11-30T12:33:21Z</dc:date>
    <item>
      <title>Joins in Macro application</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702467#M215152</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;data t1;
input id;
cards;

1
2
3
4
5
;
run;

data t2;
input id;
cards;
5
6
7
8
;
run;



%macro left(left,right ,var);
proc sql;
select *
from &amp;amp;left as a
left join &amp;amp;right as b 
on a.&amp;amp;var=b.&amp;amp;var;
quit;
%mend;

%left(t1,t2,id);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here&amp;nbsp; I am trying to join table with macro application&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to define joins for&amp;nbsp;&lt;/P&gt;&lt;P&gt;left join&lt;/P&gt;&lt;P&gt;right join&lt;/P&gt;&lt;P&gt;full join&lt;/P&gt;&lt;P&gt;inner join&lt;/P&gt;&lt;P&gt;need help me&amp;nbsp;&lt;/P&gt;&lt;P&gt;above code is correct&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 11:30:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702467#M215152</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2020-11-30T11:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: Joins in Macro application</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702470#M215154</link>
      <description>&lt;P&gt;Why do you want to do this? The SAS macro language is for generating code. Why not just write the joins with no macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if this is for practice, why do you want the answer rather than trying yourself?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 11:43:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702470#M215154</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-30T11:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Joins in Macro application</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702472#M215156</link>
      <description>i tried but how to use left ,right inner joins using macro application see above code</description>
      <pubDate>Mon, 30 Nov 2020 11:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702472#M215156</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2020-11-30T11:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Joins in Macro application</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702473#M215157</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Here&amp;nbsp; I am trying to join table with macro application&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how to define joins for&amp;nbsp;&lt;/P&gt;
&lt;P&gt;left join&lt;/P&gt;
&lt;P&gt;right join&lt;/P&gt;
&lt;P&gt;full join&lt;/P&gt;
&lt;P&gt;inner join&lt;/P&gt;
&lt;P&gt;need help me&amp;nbsp;&lt;/P&gt;
&lt;P&gt;above code is correct&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is the question that you want the code to do something other than a left join?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can simply add another argument into the macro definition that will specify the type of join.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 11:55:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702473#M215157</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-30T11:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Joins in Macro application</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702477#M215159</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t1;
input id;
cards;

1
2
3
4
5
;
run;

data t2;
input id;
cards;
5
6
7
8
;
run;



%macro abc(left,right ,var,j_type);
proc sql;
select *
from &amp;amp;left as a
&amp;amp;j_type  &amp;amp;right as b 
on a.&amp;amp;var=b.&amp;amp;var;
quit;
%mend;

%abc(t1,t2,id,right_join);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anandkvn_0-1606738225610.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52154iAE29C9C4FAD2040A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anandkvn_0-1606738225610.png" alt="Anandkvn_0-1606738225610.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 12:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702477#M215159</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2020-11-30T12:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Joins in Macro application</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702486#M215165</link>
      <description>&lt;OL&gt;
&lt;LI&gt;Post logs as text, &lt;STRONG&gt;NOT&lt;/STRONG&gt; as pictures!!&lt;/LI&gt;
&lt;LI&gt;The problem is &lt;STRONG&gt;PAINFULLY&lt;/STRONG&gt; obvious, please use your own brain for once.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 30 Nov 2020 12:33:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702486#M215165</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-30T12:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Joins in Macro application</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702487#M215166</link>
      <description>&lt;P&gt;Your macro, when all the macro variables resolve, must produce working valid legal SAS code — and it does not produce working valid legal SAS code. That's what the log is showing you. A very trivial change fixes this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's still not obvious, then you need to go back to the first step in macro writing, which is to produce code that works (in this case for your right join) without macros and without macro variables. Once you have this working, you should be able to turn it into a macro that works. If you can't produce working SAS code without macros and without macro variables, then it will never work when you add macros and add macro variables.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 13:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joins-in-Macro-application/m-p/702487#M215166</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-30T13:22:00Z</dc:date>
    </item>
  </channel>
</rss>

