<?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: Pop Quiz, Macro Syntax in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338568#M77125</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Minor syntax issues aside, you need the "minoperator" option.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;option minoperator;&lt;BR /&gt;%let testid = A967;&lt;BR /&gt;%let allids = A967 A980 A982;&lt;BR /&gt;%put &amp;amp;testid;&lt;BR /&gt;%put &amp;amp;allids;&lt;BR /&gt;&lt;BR /&gt;%macro johntest(inTestid, inallids);&lt;BR /&gt;%if &amp;amp;inTestid in (&amp;amp;inallids) %then %do;&lt;BR /&gt;%put yes;&lt;BR /&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt;%put no;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%johntest(&amp;amp;testid, &amp;amp;allids);&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2017 20:42:18 GMT</pubDate>
    <dc:creator>collinelliot</dc:creator>
    <dc:date>2017-03-06T20:42:18Z</dc:date>
    <item>
      <title>Pop Quiz, Macro Syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338562#M77122</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Quick question, I am trying to get the following to return "yes" and I can't. &amp;nbsp;I know that I am missing something like a %sysfunc or %syseval or something like that, but just can't figure it out. &amp;nbsp; I want to be able to have &amp;amp;testid defined as any of the three components of &amp;amp;allids, and have the macro return "yes".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%let testid = A967;&lt;BR /&gt;%let allids = A967 A980 A982;&lt;BR /&gt;%put &amp;amp;testid;&lt;BR /&gt;%put &amp;amp;allids;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro johntest(inTestid, inallids);&lt;/P&gt;
&lt;P&gt;%if "&amp;amp;inTestid." in "&amp;amp;inallids." %then %do;&lt;BR /&gt; %put yes;&lt;BR /&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt; %put no;&lt;BR /&gt;%end;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;%johntest(&amp;amp;testid., &amp;amp;allids.);&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338562#M77122</guid>
      <dc:creator>mahler_ji</dc:creator>
      <dc:date>2017-03-06T20:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Pop Quiz, Macro Syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338568#M77125</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Minor syntax issues aside, you need the "minoperator" option.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;option minoperator;&lt;BR /&gt;%let testid = A967;&lt;BR /&gt;%let allids = A967 A980 A982;&lt;BR /&gt;%put &amp;amp;testid;&lt;BR /&gt;%put &amp;amp;allids;&lt;BR /&gt;&lt;BR /&gt;%macro johntest(inTestid, inallids);&lt;BR /&gt;%if &amp;amp;inTestid in (&amp;amp;inallids) %then %do;&lt;BR /&gt;%put yes;&lt;BR /&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt;%put no;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%johntest(&amp;amp;testid, &amp;amp;allids);&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338568#M77125</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-03-06T20:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Pop Quiz, Macro Syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338569#M77126</link>
      <description>&lt;P&gt;If it's a pop quiz, what do we get if it we get it right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the option MINOPERATOR and note the default setting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#p0pbehl7wj5sl4n1ov1ortnehtba.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#p0pbehl7wj5sl4n1ov1ortnehtba.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, this doesn't make sense.&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;%if "&amp;amp;inTestid." in "&amp;amp;inallids." %then %do;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Resolves to :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if "A967." in "A967 A980 A982" %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Remember it always needs to be valid SAS code. This isn't.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option minoperator;
%let testid = A888;
%let allids = "A967" "A980" "A982";
%put &amp;amp;testid;
%put &amp;amp;allids;
 
%macro johntest(inTestid, inallids);
%if "&amp;amp;inTestid." in (&amp;amp;inallids.) %then %do;
%put yes;
%end;
%else %do;
%put no;
%end;
%mend;
%johntest(&amp;amp;testid., &amp;amp;allids.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338569#M77126</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-06T20:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Pop Quiz, Macro Syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338570#M77127</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;You need&lt;BR /&gt;&lt;BR /&gt;options minoperator;
%macro johntest(inTestid, inallids)/minoperator;

SOLUTION

%let testid = A967;
%let allids = A967 A980 A982;
%put &amp;amp;testid;
%put &amp;amp;allids;

options minoperator;
%macro johntest(inTestid, inallids)/minoperator;
%if &amp;amp;inTestid. in (&amp;amp;inallids.) %then %do;
%put yes;
%end;
%else %do;
%put no;
%end;
%mend;
%johntest(&amp;amp;testid., &amp;amp;allids.);


554  %let testid = A967;
1555  %let allids = A967 A980 A982;
1556  %put &amp;amp;testid;
SYMBOLGEN:  Macro variable TESTID resolves to A967
A967
1557  %put &amp;amp;allids;
SYMBOLGEN:  Macro variable ALLIDS resolves to A967 A980 A982
A967 A980 A982
1558  options minoperator;
1559  %macro johntest(inTestid, inallids)/minoperator;
1560  %if &amp;amp;inTestid. in (&amp;amp;inallids.) %then %do;
1561  %put yes;
1562  %end;
1563  %else %do;
1564  %put no;
1565  %end;
1566  %mend;
1567  %johntest(&amp;amp;testid., &amp;amp;allids.);
MLOGIC(JOHNTEST):  Beginning execution.
SYMBOLGEN:  Macro variable TESTID resolves to A967
SYMBOLGEN:  Macro variable ALLIDS resolves to A967 A980 A982
MLOGIC(JOHNTEST):  Parameter INTESTID has value A967
MLOGIC(JOHNTEST):  Parameter INALLIDS has value A967 A980 A982
SYMBOLGEN:  Macro variable INTESTID resolves to A967
SYMBOLGEN:  Macro variable INALLIDS resolves to A967 A980 A982
MLOGIC(JOHNTEST):  %IF condition &amp;amp;inTestid. in (&amp;amp;inallids.) is TRUE
MLOGIC(JOHNTEST):  %PUT yes

yes

MLOGIC(JOHNTEST):  Ending execution.




&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338570#M77127</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-03-06T20:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Pop Quiz, Macro Syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338571#M77128</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;If testid can be null 


* fails;
%johntest(%str( ), &amp;amp;allids.);


This works with nulls


if testid can be  null


%let testid = "A967";
%let allids = "A967" "A980" "A982";
%put &amp;amp;testid;
%put &amp;amp;allids;


options minoperator;
%macro johntest(inTestid, inallids)/minoperator;
%if &amp;amp;inTestid. in (&amp;amp;inallids.) %then %do;
%put yes;
%end;
%else %do;
%put no;
%end;
%mend;
%johntest(%str(""), &amp;amp;allids.);

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338571#M77128</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-03-06T20:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Pop Quiz, Macro Syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338572#M77129</link>
      <description>&lt;P&gt;All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks very much for your replies. &amp;nbsp;One quick thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way for me to turn back off this option so that it doesn't inadvertently affect other parts of the code that it shouldn't?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:50:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338572#M77129</guid>
      <dc:creator>mahler_ji</dc:creator>
      <dc:date>2017-03-06T20:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Pop Quiz, Macro Syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338573#M77130</link>
      <description>&lt;P&gt;&lt;SPAN&gt;NOMINOPERATOR&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338573#M77130</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-03-06T20:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Pop Quiz, Macro Syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338575#M77131</link>
      <description>&lt;P&gt;Option nominoperator;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338575#M77131</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-06T20:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Pop Quiz, Macro Syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338576#M77132</link>
      <description>&lt;P&gt;You may not have the macro IN operator turned on and possibly have a different delimiter&lt;/P&gt;
&lt;P&gt;See if this helps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro johntest(inTestid, inallids)/minoperator mindelimiter=' ';
   %if %eval(&amp;amp;inTestid in &amp;amp;inallids) %then %do;
      %put yes;
   %end;
   %else %do;
      %put no;
   %end;
%mend;

%johntest(&amp;amp;testid, &amp;amp;allids);&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:53:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338576#M77132</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-06T20:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Pop Quiz, Macro Syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338577#M77133</link>
      <description>&lt;P&gt;Thank you all!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are the best. &amp;nbsp;I will test this out right now!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pop-Quiz-Macro-Syntax/m-p/338577#M77133</guid>
      <dc:creator>mahler_ji</dc:creator>
      <dc:date>2017-03-06T20:53:56Z</dc:date>
    </item>
  </channel>
</rss>

