<?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: where statement in a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/where-statement-in-a-macro/m-p/731402#M227829</link>
    <description>&lt;P&gt;The macro call:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%analysis(biweekly,amount_food_consumed,ID="LION-1");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is referencing a macro parameter named ID, but the macro does not define a parameter named id.&lt;/P&gt;
&lt;P&gt;Call the CONDITION parameter by name instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%analysis(biweekly,amount_food_consumed,condition=ID="LION-1");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or add parentheses into the condition value.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%analysis(biweekly,amount_food_consumed,(ID="LION-1"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Apr 2021 19:16:51 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-04-05T19:16:51Z</dc:date>
    <item>
      <title>where statement in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-statement-in-a-macro/m-p/731401#M227828</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a macro to run PROC FREQs for a descriptive statistics table to be used in a paper. I am trying to run the same PROC FREQ for different IDs, so I am using a where statement within the macro. The code I am using is pasted below - when I run this code, SAS tells me "keyword parameter ID was not defined within the macro." I appreciate any help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro analysis(dataset,variable,condition);&lt;BR /&gt;proc freq data=&amp;amp;dataset;&lt;BR /&gt;tables &amp;amp;variable;&lt;BR /&gt;where &amp;amp;condition;&lt;BR /&gt;run;&lt;BR /&gt;%mend analysis;&lt;BR /&gt;%analysis(biweekly,amount_food_consumed,ID="LION-1");&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 19:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-statement-in-a-macro/m-p/731401#M227828</guid>
      <dc:creator>wisej</dc:creator>
      <dc:date>2021-04-05T19:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: where statement in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-statement-in-a-macro/m-p/731402#M227829</link>
      <description>&lt;P&gt;The macro call:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%analysis(biweekly,amount_food_consumed,ID="LION-1");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is referencing a macro parameter named ID, but the macro does not define a parameter named id.&lt;/P&gt;
&lt;P&gt;Call the CONDITION parameter by name instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%analysis(biweekly,amount_food_consumed,condition=ID="LION-1");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or add parentheses into the condition value.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%analysis(biweekly,amount_food_consumed,(ID="LION-1"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 19:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-statement-in-a-macro/m-p/731402#M227829</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-05T19:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: where statement in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-statement-in-a-macro/m-p/731403#M227830</link>
      <description>&lt;P&gt;That worked - thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 19:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-statement-in-a-macro/m-p/731403#M227830</guid>
      <dc:creator>wisej</dc:creator>
      <dc:date>2021-04-05T19:14:32Z</dc:date>
    </item>
  </channel>
</rss>

