<?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: Pass in a &amp;quot;Where&amp;quot; into a %Macro...? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417123#M280326</link>
    <description>&lt;P&gt;that simple?&lt;/P&gt;&lt;P&gt;lol guess i shouldve tried it first! Thanks! testing now&lt;/P&gt;</description>
    <pubDate>Wed, 29 Nov 2017 16:20:05 GMT</pubDate>
    <dc:creator>StaticFX</dc:creator>
    <dc:date>2017-11-29T16:20:05Z</dc:date>
    <item>
      <title>Pass in a "Where" into a %Macro...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417119#M280324</link>
      <description>&lt;P&gt;Is it possible to pass in a Where? like...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro test(where);

proc sql;
   create table temp as
   select field1, field2 from tableA where &amp;amp;where;
quit;

%mend test;

%test("ap_period='1234'")&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Nov 2017 16:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417119#M280324</guid>
      <dc:creator>StaticFX</dc:creator>
      <dc:date>2017-11-29T16:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Pass in a "Where" into a %Macro...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417121#M280325</link>
      <description>Yes, but you will need to change your SQL into&lt;BR /&gt;where %unquote(&amp;amp;where);</description>
      <pubDate>Wed, 29 Nov 2017 16:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417121#M280325</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2017-11-29T16:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pass in a "Where" into a %Macro...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417123#M280326</link>
      <description>&lt;P&gt;that simple?&lt;/P&gt;&lt;P&gt;lol guess i shouldve tried it first! Thanks! testing now&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 16:20:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417123#M280326</guid>
      <dc:creator>StaticFX</dc:creator>
      <dc:date>2017-11-29T16:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Pass in a "Where" into a %Macro...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417128#M280327</link>
      <description>&lt;P&gt;Yes, but slightly easier if you use WHERE =&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(where=);

proc sql;
   create table temp as
   select name, age from sashelp.class where &amp;amp;where;
quit;

%mend test;

%test(where= age=15);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173987"&gt;@StaticFX&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Is it possible to pass in a Where? like...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro test(where);

proc sql;
   create table temp as
   select field1, field2 from tableA where &amp;amp;where;
quit;

%mend test;

%test("ap_period='1234'")&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 16:23:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417128#M280327</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-29T16:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Pass in a "Where" into a %Macro...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417140#M280328</link>
      <description>&lt;P&gt;Bingo! the first way didnt quite work.. this works perfectly thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 16:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417140#M280328</guid>
      <dc:creator>StaticFX</dc:creator>
      <dc:date>2017-11-29T16:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Pass in a "Where" into a %Macro...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417146#M280329</link>
      <description>&lt;P&gt;Just wrap your condition inside of parentheses instead of quotes.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%test((ap_period='1234'))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also note that you can use named parameters in the macro call, even if the macro has it defined as a positional argument.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You just can't try to pass a value by position when the parameter is defined as named in the %macro statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%test(where=ap_period='1234')&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Nov 2017 16:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pass-in-a-quot-Where-quot-into-a-Macro/m-p/417146#M280329</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-11-29T16:58:02Z</dc:date>
    </item>
  </channel>
</rss>

