<?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 statment in Proc SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268894#M53270</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw﻿&lt;/a&gt;. &amp;nbsp;Thank you. I also wonder the progam flow of this code. &amp;nbsp;Does the %IF statment executes first to generate the &amp;nbsp;SAS statements before Proc Sql statement?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 May 2016 19:38:56 GMT</pubDate>
    <dc:creator>SAS_inquisitive</dc:creator>
    <dc:date>2016-05-06T19:38:56Z</dc:date>
    <item>
      <title>Macro statment in Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268887#M53266</link>
      <description>&lt;PRE&gt;%macro m(text);
  proc sql noprint;
   create table t as
     select *
	   from sashelp.class
	 %if &amp;amp;text ^=%str() %then where name="William"; %str(;)
   quit;
%mend m;
%m(tx)&lt;/PRE&gt;&lt;P&gt;I have a SAS program above. When I remove %str( ; ), it does not work.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 19:21:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268887#M53266</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-05-06T19:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statment in Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268890#M53268</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/64404"&gt;@SAS_inquisitive﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you can simplify the line "%if ..." to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;text ^= %then where name="William";;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first semicolon ends the %THEN statement, the second semicolon ends the SELECT statement.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 19:26:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268890#M53268</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-06T19:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statment in Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268891#M53269</link>
      <description>&lt;P&gt;You should specify "how it doesn't work".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you run the not working code with Options mprint;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you will see that there is no semi-colon in the code before the Quit. So Quit is encountered in an expected place:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; from sashelp.class&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; from sashelp.class&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where name="William"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 19:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268891#M53269</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-06T19:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statment in Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268894#M53270</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw﻿&lt;/a&gt;. &amp;nbsp;Thank you. I also wonder the progam flow of this code. &amp;nbsp;Does the %IF statment executes first to generate the &amp;nbsp;SAS statements before Proc Sql statement?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 19:38:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268894#M53270</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-05-06T19:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statment in Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268900#M53272</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/64404"&gt;@SAS_inquisitive&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Does the %IF statment executes first to generate the &amp;nbsp;SAS statements before Proc Sql statement?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, sure. That's how SAS macro language works. Roughly speaking, the macro processor generates the code (data steps, proc steps, other non-macro statements) that is eventually sent to the compiler. Please see the documentation &lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/viewer.htm#p0znr2zp0ubdzjn10wmhw0y2ef1q.htm" target="_blank"&gt;How SAS Processes Statements with Macro Activity&lt;/A&gt; for a detailed overview.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 19:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statment-in-Proc-SQL/m-p/268900#M53272</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-06T19:49:59Z</dc:date>
    </item>
  </channel>
</rss>

