<?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 Required operator not found in expression in macro statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567477#M159579</link>
    <description>&lt;P&gt;I need this macro to repeat the data processing for each set of variable ending in 0,1,2, 3,4,5,6,7,8,9,10 and 13.&amp;nbsp; I can getting the following error message&amp;nbsp;&amp;nbsp;Required operator not found in expression: &amp;amp;b. in (0,1,2,3,4,5,6,7,8,9,10,13)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro life_events();&lt;BR /&gt;%let b=0; /*initializ counter*/&lt;/P&gt;&lt;P&gt;%do %while (&amp;amp;b &amp;lt;=13);&lt;BR /&gt;%put &amp;amp;b;&lt;BR /&gt;%if &amp;amp;b. in (0,1,2,3,4,5,6,7,8,9,10,13) %then %do;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;array event(18) evt1-evt18;&lt;BR /&gt;array evtorig[18] startne&amp;amp;b worktrb&amp;amp;b quitjob&amp;amp;b workloa&amp;amp;b prtunem&amp;amp;b moneypr&amp;amp;b&lt;BR /&gt;worsrel&amp;amp;b relaten&amp;amp;b seripro&amp;amp;b childmo&amp;amp;b respcar&amp;amp;b legalpr&amp;amp;b creldie&amp;amp;b&lt;BR /&gt;closdie&amp;amp;b selfvio&amp;amp;b famlvio&amp;amp;b physill&amp;amp;b majeven&amp;amp;b;&lt;BR /&gt;%do e = 1 %to 18;&lt;BR /&gt;event(e) = evtorig[e];&lt;BR /&gt;%if event(e) lt 0 %then event(e) = .;&lt;BR /&gt;%end;&lt;BR /&gt;array count(18) cnt1-cnt18;&lt;BR /&gt;array eventC[18] evt1-evt18;&lt;BR /&gt;%do c = 1 %to 18;&lt;BR /&gt;count(c) = eventC[c];&lt;BR /&gt;%if count(c) lt 2 %then count(c) = .;&lt;BR /&gt;%end;&lt;BR /&gt;EVNTNUM&amp;amp;b = (n(of cnt1-cnt18));&lt;BR /&gt;array very(18) vry1-vry18;&lt;BR /&gt;array eventV[18] evt1-evt18;&lt;BR /&gt;%do v = 1 %to 18;&lt;BR /&gt;very(v) = eventV[v];&lt;BR /&gt;%if very(v) lt 4 %then very(v) = .;&lt;BR /&gt;%end;&lt;BR /&gt;EVNTVRY&amp;amp;b = (n(of vry1-vry18));&lt;BR /&gt;EVNTCAT&amp;amp;b = evntvry&amp;amp;b.;&lt;BR /&gt;%if EVNTVRY&amp;amp;b ge 2 %then evntcat&amp;amp;b = 2;&lt;BR /&gt;NonMiss = n(of evt1-evt18);&lt;BR /&gt;%if NonMiss lt 14 %then %do;&lt;BR /&gt;EVNTNUM&amp;amp;b = .;&lt;BR /&gt;EVNTVRY&amp;amp;b = .;&lt;BR /&gt;EVNTCAT&amp;amp;b = .;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;%let b=%sysevalf(&amp;amp;b+1); /*increment b*/&lt;BR /&gt;%end;&lt;BR /&gt;%mend life_events;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jun 2019 23:11:45 GMT</pubDate>
    <dc:creator>Stat_prevmed</dc:creator>
    <dc:date>2019-06-19T23:11:45Z</dc:date>
    <item>
      <title>Required operator not found in expression in macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567477#M159579</link>
      <description>&lt;P&gt;I need this macro to repeat the data processing for each set of variable ending in 0,1,2, 3,4,5,6,7,8,9,10 and 13.&amp;nbsp; I can getting the following error message&amp;nbsp;&amp;nbsp;Required operator not found in expression: &amp;amp;b. in (0,1,2,3,4,5,6,7,8,9,10,13)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro life_events();&lt;BR /&gt;%let b=0; /*initializ counter*/&lt;/P&gt;&lt;P&gt;%do %while (&amp;amp;b &amp;lt;=13);&lt;BR /&gt;%put &amp;amp;b;&lt;BR /&gt;%if &amp;amp;b. in (0,1,2,3,4,5,6,7,8,9,10,13) %then %do;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;array event(18) evt1-evt18;&lt;BR /&gt;array evtorig[18] startne&amp;amp;b worktrb&amp;amp;b quitjob&amp;amp;b workloa&amp;amp;b prtunem&amp;amp;b moneypr&amp;amp;b&lt;BR /&gt;worsrel&amp;amp;b relaten&amp;amp;b seripro&amp;amp;b childmo&amp;amp;b respcar&amp;amp;b legalpr&amp;amp;b creldie&amp;amp;b&lt;BR /&gt;closdie&amp;amp;b selfvio&amp;amp;b famlvio&amp;amp;b physill&amp;amp;b majeven&amp;amp;b;&lt;BR /&gt;%do e = 1 %to 18;&lt;BR /&gt;event(e) = evtorig[e];&lt;BR /&gt;%if event(e) lt 0 %then event(e) = .;&lt;BR /&gt;%end;&lt;BR /&gt;array count(18) cnt1-cnt18;&lt;BR /&gt;array eventC[18] evt1-evt18;&lt;BR /&gt;%do c = 1 %to 18;&lt;BR /&gt;count(c) = eventC[c];&lt;BR /&gt;%if count(c) lt 2 %then count(c) = .;&lt;BR /&gt;%end;&lt;BR /&gt;EVNTNUM&amp;amp;b = (n(of cnt1-cnt18));&lt;BR /&gt;array very(18) vry1-vry18;&lt;BR /&gt;array eventV[18] evt1-evt18;&lt;BR /&gt;%do v = 1 %to 18;&lt;BR /&gt;very(v) = eventV[v];&lt;BR /&gt;%if very(v) lt 4 %then very(v) = .;&lt;BR /&gt;%end;&lt;BR /&gt;EVNTVRY&amp;amp;b = (n(of vry1-vry18));&lt;BR /&gt;EVNTCAT&amp;amp;b = evntvry&amp;amp;b.;&lt;BR /&gt;%if EVNTVRY&amp;amp;b ge 2 %then evntcat&amp;amp;b = 2;&lt;BR /&gt;NonMiss = n(of evt1-evt18);&lt;BR /&gt;%if NonMiss lt 14 %then %do;&lt;BR /&gt;EVNTNUM&amp;amp;b = .;&lt;BR /&gt;EVNTVRY&amp;amp;b = .;&lt;BR /&gt;EVNTCAT&amp;amp;b = .;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;%let b=%sysevalf(&amp;amp;b+1); /*increment b*/&lt;BR /&gt;%end;&lt;BR /&gt;%mend life_events;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 23:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567477#M159579</guid>
      <dc:creator>Stat_prevmed</dc:creator>
      <dc:date>2019-06-19T23:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Required operator not found in expression in macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567482#M159582</link>
      <description>&lt;P&gt;Ugh. You commit the (sadly common) cardinal sin of trying to handle data with the macro preprocessor, which is for creating dynamic code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you already know how to define arrays, why don't you just use the necessary data step do loops to iterate through the arrays? As far as I can see it, there is absolutely no need for macro processing here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 23:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567482#M159582</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-19T23:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Required operator not found in expression in macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567492#M159587</link>
      <description>&lt;P&gt;What code are trying to have that macro generate?&lt;/P&gt;
&lt;P&gt;I think you will have get error messages since it appears to be generating the same ARRAY multiple times.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 01:00:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567492#M159587</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-20T01:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Required operator not found in expression in macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567493#M159588</link>
      <description>&lt;P&gt;If you want to use the word IN to be an operator in macro code you need to tell the macro processor that in advance.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro life_events() / minoperator mindelimiter=',' ;
...
%if &amp;amp;b. in 0,1,2,3,4,5,6,7,8,9,10,13 %then %do;
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But it is not needed in this case.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do b=0 %to 13 ;
  %if not (&amp;amp;b=11 or &amp;amp;b=12) %then %do;
  ...
  %end;
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jun 2019 01:11:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567493#M159588</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-20T01:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Required operator not found in expression in macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567641#M159648</link>
      <description>&lt;P&gt;Thank you so much.&amp;nbsp; This made the difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 14:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Required-operator-not-found-in-expression-in-macro-statement/m-p/567641#M159648</guid>
      <dc:creator>Stat_prevmed</dc:creator>
      <dc:date>2019-06-20T14:54:54Z</dc:date>
    </item>
  </channel>
</rss>

