<?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: Is there an equivalent to &amp;quot;IN&amp;quot; for macros? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-equivalent-to-quot-IN-quot-for-macros/m-p/867987#M342821</link>
    <description>&lt;P&gt;See the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p0pbehl7wj5sl4n1ov1ortnehtba.htm" target="_self"&gt;MINOPERATOR&lt;/A&gt; option and the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n0vc5y2nyi55dvn1agla9j658kwh.htm" target="_self"&gt;MINDELIMITER option&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2023 13:37:40 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-04-04T13:37:40Z</dc:date>
    <item>
      <title>Is there an equivalent to "IN" for macros?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-equivalent-to-quot-IN-quot-for-macros/m-p/867986#M342820</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code is similar to below. I have a lot of different datasets and %if &amp;amp;dsn in (CMD DEM DV2) doesn't seem to work. Is there a different command that does the same thing?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro Counts(dsn, varlist);
data &amp;amp;dsn.1;
set an.&amp;amp;dsn_an;
%if &amp;amp;dsn= CMD|&amp;amp;dsn= DEM|&amp;amp;dsn= DV2 %then %do;
where protseg in ('A' 'B');
%end;
array vars{*} &amp;amp;varlist.;
num=0; den=0;
do i=1 to dim(vars);
if vars{i} in ("a" "d" "g" "j") then den = sum(den, 1); /*denominator*/
if vars{i} in ("j") then num = sum(num, 1); /*numerator*/
end;
run;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 13:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-equivalent-to-quot-IN-quot-for-macros/m-p/867986#M342820</guid>
      <dc:creator>mariko5797</dc:creator>
      <dc:date>2023-04-04T13:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an equivalent to "IN" for macros?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-equivalent-to-quot-IN-quot-for-macros/m-p/867987#M342821</link>
      <description>&lt;P&gt;See the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p0pbehl7wj5sl4n1ov1ortnehtba.htm" target="_self"&gt;MINOPERATOR&lt;/A&gt; option and the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n0vc5y2nyi55dvn1agla9j658kwh.htm" target="_self"&gt;MINDELIMITER option&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 13:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-equivalent-to-quot-IN-quot-for-macros/m-p/867987#M342821</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-04-04T13:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an equivalent to "IN" for macros?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-equivalent-to-quot-IN-quot-for-macros/m-p/867989#M342823</link>
      <description>&lt;P&gt;If you want the macro processor to treat IN as an operator you need to tell it that with the MINOPERATOR option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if&amp;nbsp;you are going to use IN as an operator inside a macro definition then it is best to set that option on %MACRO statement instead of depending on the whims of the user that is calling the macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro Counts(dsn, varlist) / minoperator mindelimter=' ';
data &amp;amp;dsn.1;
  set an.&amp;amp;dsn_an;
%if &amp;amp;dsn in CMD DEM DV2 %then %do;
  where protseg in ('A' 'B');
%end;
  array vars{*} &amp;amp;varlist.;
  num=0; den=0;
  do i=1 to dim(vars);
/*denominator*/
    if vars{i} in ("a" "d" "g" "j") then den = sum(den, 1);
/*numerator*/
    if vars{i} in ("j") then num = sum(num, 1); 
  end;
run;
%mend Counts;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PS Make it easier to read the code by placing comments about what the code is going to do BEFORE the code instead of afterwords.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 15:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-equivalent-to-quot-IN-quot-for-macros/m-p/867989#M342823</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-04-04T15:10:09Z</dc:date>
    </item>
  </channel>
</rss>

