<?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: Macro error in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Macro-error/m-p/268494#M58093</link>
    <description>&lt;P&gt;SQL parses statements a little differently.&amp;nbsp; Try it this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%unquote(&amp;amp;OWNER..MOANAATM_&amp;amp;TABELLA)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2016 12:54:11 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-05-05T12:54:11Z</dc:date>
    <item>
      <title>Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-error/m-p/268492#M58092</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;i have create this sas macro:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	%MACRO MACROFILTRO (TABELLA=, OWNER= );
	PROC SQL;
	CREATE TABLE ATM.T7_D_ELENCO_TERMINALI_IMP AS 

	SELECT * FROM ATM.T7_D_ELENCO_TERMINALI_IMP

	UNION ALL

	SELECT C.*, B.IM_TOT_CARIC, B.CO_ID_OLI
	FROM ATM.T7_D_ELENCO_TERMINALI_VER1 A
	INNER JOIN ATM.T01C_CANONI C ON (A.KEYATM = C.KEYATM)
	LEFT JOIN &amp;amp;OWNER..MOANAATM_&amp;amp;TABELLA B ON (A.KEYATM = B.KEYATM) /* 1° 102015 2° 082015 3° 062015 4* 042015 5° 022015 6° 012015 7°122014 8° 112014 9°062014 10° 012014 11° 082013*/
	WHERE B.KEYATM IS NOT NULL
	;
	quit;

	%MEND MACROFILTRO;
	%MACROFILTRO(TABELLA=%Str(102015), OWNER= %Str(TERM) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;why i have this error ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1780      WHERE B.KEYATM IS NOT NULL
1781      ;
1782      quit;
1783
1784      %MEND MACROFILTRO;
1785      %MACROFILTRO(TABELLA=%Str(102015), OWNER= %Str(TERM) );
NOTE: Line generated by the macro variable "TABELLA".
1     TERM.MOANAATM_102015
                    ------
                    22
                     ------
                     200
ERROR 22-322: Syntax error, expecting one of the following: a name, (, AS, ON.

ERROR 200-322: The symbol is not recognized and will be ignored.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks!!!!!!!!!!!!!!!!!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 12:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-error/m-p/268492#M58092</guid>
      <dc:creator>Cello23</dc:creator>
      <dc:date>2016-05-05T12:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-error/m-p/268494#M58093</link>
      <description>&lt;P&gt;SQL parses statements a little differently.&amp;nbsp; Try it this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%unquote(&amp;amp;OWNER..MOANAATM_&amp;amp;TABELLA)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 12:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-error/m-p/268494#M58093</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-05T12:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-error/m-p/268497#M58094</link>
      <description>Perfect!!!!&lt;BR /&gt;thanks!!!</description>
      <pubDate>Thu, 05 May 2016 12:58:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-error/m-p/268497#M58094</guid>
      <dc:creator>Cello23</dc:creator>
      <dc:date>2016-05-05T12:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-error/m-p/268510#M58095</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know you have your answer but I wanted to throw a few things in there:&lt;/P&gt;
&lt;P&gt;Firstly, why the macro in the first place, it doesn't seem to add anything. &amp;nbsp;Try not to obfuscate code for no reason.&lt;/P&gt;
&lt;P&gt;- Try to avoid coding all in upper case, it makes reading code very hard. &amp;nbsp;I know SQL tends to put variables and tabes in uppercase, which is fine. &amp;nbsp;See below an example.&lt;/P&gt;
&lt;P&gt;Finally, why are you union all data from the table and some other data? &amp;nbsp;Why not just insert the additional data into the existing dataset? &amp;nbsp;Again, example below:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  insert into ATM.T7_D_ELENCO_TERMINALI_IMP  
  select  C.*, 
          B.IM_TOT_CARIC, 
          B.CO_ID_OLI
  from    ATM.T7_D_ELENCO_TERMINALI_VER1 A
  inner join ATM.T01C_CANONI C 
  on      A.KEYATM=C.KEYATM
  left join TERM.MOANAATM_102015 B 
  on      A.KEYATM=B.KEYATM
  where   B.KEYATM IS NOT NULL;
quit;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 May 2016 13:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-error/m-p/268510#M58095</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-05T13:24:02Z</dc:date>
    </item>
  </channel>
</rss>

