<?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: Left join with a table that is not exisiting in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670893#M201436</link>
    <description>&lt;P&gt;To be able to use %IF-%THEN %DO-%END in open code, you need to have the current maintenance level of SAS 9.4, which is M6. I mentioned that earlier.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jul 2020 08:44:34 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-07-21T08:44:34Z</dc:date>
    <item>
      <title>Left join with a table that is not exisiting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670428#M201254</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to perform left join with a data set that is not existing.&lt;/P&gt;
&lt;P&gt;I want to create a dynamic process that IF data set bbb&amp;nbsp; doesn't exist then I will not get an error .&lt;/P&gt;
&lt;P&gt;I get an error&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;37 QUIT;&lt;BR /&gt;____&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: ',', GROUP, HAVING, ORDER, WHERE.&lt;/P&gt;
&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data aaa;
input id x;
cards;
1 10
2 20
3 30
;
run;
 
%macro xxx;
PROC SQL;
	create table wanted  as
	select  a.*,b.Y
	from  aaa as a
	%if %sysfunc(exist(bbb)) %then
	left join bbb as b
	on a.id=b.id  
;
QUIT;
%mend xxx;
%xxx;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Jul 2020 06:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670428#M201254</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-07-19T06:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with a table that is not exisiting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670432#M201257</link>
      <description>&lt;P&gt;You are missing a semicolon (one is needed to terminate the %IF, the other for the SQL SELECT).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since SAS 9.4M6, you do not need a macro definition anymore:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table wanted  as
  select a.*, b.Y
  from aaa as a
%if %sysfunc(exist(bbb)) %then %do;
  left join bbb as b
  on a.id = b.id  
%end;
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Jul 2020 06:52:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670432#M201257</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-19T06:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with a table that is not exisiting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670435#M201260</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I still&amp;nbsp; recieve an error&amp;nbsp; &amp;nbsp;(I am using SAS enterprise&amp;nbsp; guide 7.1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data aaa;
input id x;
cards;
1 10
2 20
3 30
;
run;


proc sql;
create table wanted  as
  select a.*, b.Y
  from aaa as a
%if %sysfunc(exist(bbb)) %then %do;
  left join bbb as b
  on a.id = b.id  
%end;
;
quit;
/*ERROR: The %IF statement is not valid in open code.*/


%macro RRR;
proc sql;
create table wanted  as
  select a.*, b.Y
  from aaa as a
%if %sysfunc(exist(bbb)) %then %do;
  left join bbb as b
  on a.id = b.id  
%end;
;
quit;
%mend RRR;
%RRR;
/*ERROR: Unresolved reference to table/correlation name b.*/
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 07:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670435#M201260</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-07-19T07:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with a table that is not exisiting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670436#M201261</link>
      <description>&lt;P&gt;You need to enclose&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;, b.y&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in a similar ⁵IF-%THEN-%DO-%END block.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 07:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670436#M201261</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-19T07:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with a table that is not exisiting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670437#M201262</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;Still got an error&lt;/P&gt;
&lt;P&gt;___&lt;BR /&gt;22&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, ',', -, '.', /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, AS, &lt;BR /&gt;CONTAINS, EQ, EQT, FROM, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro RRR;
proc sql;
create table wanted  as
  select a.*,%if %sysfunc(exist(bbb)) %then %do; b.Y %end;
  from aaa as a
%if %sysfunc(exist(bbb)) %then %do;
  left join bbb as b
  on a.id = b.id  
%end;
;
quit;
%mend RRR;
%RRR;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Jul 2020 07:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670437#M201262</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-07-19T07:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with a table that is not exisiting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670438#M201263</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Please pay attention to detsils!&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will see that the comma is part of the conditional code.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 07:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670438#M201263</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-19T07:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Left join with a table that is not exisiting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670893#M201436</link>
      <description>&lt;P&gt;To be able to use %IF-%THEN %DO-%END in open code, you need to have the current maintenance level of SAS 9.4, which is M6. I mentioned that earlier.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2020 08:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-with-a-table-that-is-not-exisiting/m-p/670893#M201436</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-21T08:44:34Z</dc:date>
    </item>
  </channel>
</rss>

