<?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 keyword parameters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/keyword-parameters/m-p/484129#M125644</link>
    <description>&lt;P&gt;I am trying to learn keyword parameters in macro.&lt;/P&gt;&lt;P&gt;May someone explain and fix the code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data tbl;
input ID  branch;
cards;
1 100
2 100
3 200
4 300
5 400
6 500
7 500
8 500
9 500
10 500
;
run;
%macro rjoe(branchP=100);
PROC SQL;
	create table outcome as
	select *	   
	from tbl
	where branch in (&amp;amp;branchP.)
;
QUIT;
proc print noobs;run;
%mend;
%rjoe;
%rjoe(branchP=200);
%rjoe(branchP=300);
%rjoe(branchP&amp;gt;=0);/*No working*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 05 Aug 2018 10:58:37 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2018-08-05T10:58:37Z</dc:date>
    <item>
      <title>keyword parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keyword-parameters/m-p/484129#M125644</link>
      <description>&lt;P&gt;I am trying to learn keyword parameters in macro.&lt;/P&gt;&lt;P&gt;May someone explain and fix the code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data tbl;
input ID  branch;
cards;
1 100
2 100
3 200
4 300
5 400
6 500
7 500
8 500
9 500
10 500
;
run;
%macro rjoe(branchP=100);
PROC SQL;
	create table outcome as
	select *	   
	from tbl
	where branch in (&amp;amp;branchP.)
;
QUIT;
proc print noobs;run;
%mend;
%rjoe;
%rjoe(branchP=200);
%rjoe(branchP=300);
%rjoe(branchP&amp;gt;=0);/*No working*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 Aug 2018 10:58:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keyword-parameters/m-p/484129#M125644</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-08-05T10:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: keyword parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keyword-parameters/m-p/484135#M125648</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%rjoe(branchP&amp;gt;=0);/*No working*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no such thing as calling a macro where you insert the &amp;gt; sign where the equal sign ought to go. Macro arguments can't work this way, you must have the macro variable name followed by an equal sign. Do not try to MIX and MATCH data step syntax in your macro call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, when your macro runs, it must produce valid working SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, when your macro runs, it seems like you want it to produce&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;where branch in (&amp;gt;=0)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which is not valid working SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the macro calls to produce legal SAS code, something like this (and there are other ways to accomplish the same)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro rjoe(branchP=);
PROC SQL;
	create table outcome as
	select *	   
	from tbl
	where branch &amp;amp;branchP
;
QUIT;
proc print noobs;run;
%mend;
%rjoe(branchP = %str(eq 100))
%rjoe(branchP = %str(eq 200))
%rjoe(branchP = %str(eq 300))
%rjoe(branchP = %str(ge 0))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Aug 2018 12:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keyword-parameters/m-p/484135#M125648</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-08-05T12:11:49Z</dc:date>
    </item>
  </channel>
</rss>

