<?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: Need help passing a macro variable in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Need-help-passing-a-macro-variable/m-p/55091#M2534</link>
    <description>This should be posted in the forum "SAS Macro Facility, Data Step and SAS Language Elements".  It has nothing to do with SAS Statistical Procedures.&lt;BR /&gt;
&lt;BR /&gt;
That said, you should be able to pass the string for cat1 by using the %str() macro quoting function.&lt;BR /&gt;
&lt;BR /&gt;
%cat(cat1=%str('Apparel, Accessories &amp;amp; Footwear','Other','Toys'), cat=allvert);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I would note that your %macro statement names cat1 as a positional parameter and cat as a keyword parameter.  However, your invocation shows that you intend to use cat1 as a keyword parameter.  Code which is consistent for both macro definition and invocation would be:&lt;BR /&gt;
&lt;BR /&gt;
%macro cat(cat1=, cat=);&lt;BR /&gt;
&lt;BR /&gt;
data &amp;amp;cat;&lt;BR /&gt;
set lastqcomp;&lt;BR /&gt;
where vertical in (&amp;amp;cat1);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%mend cat;&lt;BR /&gt;
&lt;BR /&gt;
%cat(cat1=%str('Apparel, Accessories &amp;amp; Footwear','Other','Toys'), cat=allvert);</description>
    <pubDate>Fri, 23 Jul 2010 19:06:02 GMT</pubDate>
    <dc:creator>Dale</dc:creator>
    <dc:date>2010-07-23T19:06:02Z</dc:date>
    <item>
      <title>Need help passing a macro variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Need-help-passing-a-macro-variable/m-p/55090#M2533</link>
      <description>Hi, I need to pass the cat1 variable into the in statement, but the macro doesn't like the commas.  how can i pass multiple verticals in the same variable?&lt;BR /&gt;
&lt;BR /&gt;
%macro cat(cat1, cat=);&lt;BR /&gt;
&lt;BR /&gt;
data &amp;amp;cat;&lt;BR /&gt;
set lastqcomp;&lt;BR /&gt;
where vertical in (&amp;amp;cat1);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%mend cat;&lt;BR /&gt;
&lt;BR /&gt;
%cat(cat1='Apparel, Accessories &amp;amp; Footwear','Other','Toys' cat=allvert);</description>
      <pubDate>Fri, 23 Jul 2010 17:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Need-help-passing-a-macro-variable/m-p/55090#M2533</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-23T17:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need help passing a macro variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Need-help-passing-a-macro-variable/m-p/55091#M2534</link>
      <description>This should be posted in the forum "SAS Macro Facility, Data Step and SAS Language Elements".  It has nothing to do with SAS Statistical Procedures.&lt;BR /&gt;
&lt;BR /&gt;
That said, you should be able to pass the string for cat1 by using the %str() macro quoting function.&lt;BR /&gt;
&lt;BR /&gt;
%cat(cat1=%str('Apparel, Accessories &amp;amp; Footwear','Other','Toys'), cat=allvert);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I would note that your %macro statement names cat1 as a positional parameter and cat as a keyword parameter.  However, your invocation shows that you intend to use cat1 as a keyword parameter.  Code which is consistent for both macro definition and invocation would be:&lt;BR /&gt;
&lt;BR /&gt;
%macro cat(cat1=, cat=);&lt;BR /&gt;
&lt;BR /&gt;
data &amp;amp;cat;&lt;BR /&gt;
set lastqcomp;&lt;BR /&gt;
where vertical in (&amp;amp;cat1);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%mend cat;&lt;BR /&gt;
&lt;BR /&gt;
%cat(cat1=%str('Apparel, Accessories &amp;amp; Footwear','Other','Toys'), cat=allvert);</description>
      <pubDate>Fri, 23 Jul 2010 19:06:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Need-help-passing-a-macro-variable/m-p/55091#M2534</guid>
      <dc:creator>Dale</dc:creator>
      <dc:date>2010-07-23T19:06:02Z</dc:date>
    </item>
  </channel>
</rss>

