<?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: Macro cycle 1 is fine, fails on cycle 2 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258303#M49722</link>
    <description>&lt;P&gt;Absolute speculation ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Purely a wild guess ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like you are willing to use a system of defining macros within another macro (usually frowned upon!).&amp;nbsp; Also, I imagine that you have simplified your code to make your question manageable in size.&amp;nbsp; So, what I suspect ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Within your system of macros calling macros, one of the macros redefines the meaning of %MOD.&amp;nbsp; So the second time, it means something totally different than what it did the first time.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Mar 2016 18:04:04 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-03-22T18:04:04Z</dc:date>
    <item>
      <title>Macro cycle 1 is fine, fails on cycle 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258288#M49715</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to run this code and it runs through the mod=1 cycle just fine.&amp;nbsp; No errors.&amp;nbsp; But the minute it gets to %mod(mod=2), then it says:&lt;/P&gt;&lt;P&gt;ERROR: All positional parameters must precede keyword parameters.&lt;BR /&gt;41&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %mod(mod=2);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;/*Add three variables from the PayerOnESRD dataset to the ALL $Ds and split out for M and N.*/&lt;BR /&gt;%macro mod(mod=);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%macro splitd(lib=,type=,chgdt=,chgtype=);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%do year4=&amp;amp;start. %to &amp;amp;end.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let yr = %eval(%substr(&amp;amp;year4,3,2));&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;create table &amp;amp;lib..inc_&amp;amp;mod.y&amp;amp;yr. as&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;select a.*,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;b.esrdpaystat as paystat,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;b.&amp;amp;chgdt. as paychgdt,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;b.&amp;amp;chgtype. as paychgtype&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;from ialld.in_&amp;amp;mod.y&amp;amp;yr. a left join pay.payeronesrd b&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;on a.kecc_id=b.kecc_id&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;where ESRDM="&amp;amp;type.";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;quit;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%mend splitd;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%splitd(lib=imd,&amp;nbsp;&amp;nbsp; &amp;nbsp;type=M,&amp;nbsp;&amp;nbsp; &amp;nbsp;chgdt=M2NMChgDt,&amp;nbsp;&amp;nbsp; &amp;nbsp;chgtype=m2nmchgtype);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%splitd(lib=inmd,&amp;nbsp;&amp;nbsp; &amp;nbsp;type=NM,chgdt=NM2MChgDt,&amp;nbsp;&amp;nbsp; &amp;nbsp;chgtype=nm2mchgtype);&lt;BR /&gt;%mend;&lt;BR /&gt;%mod(mod=1);&lt;BR /&gt;%mod(mod=2);&lt;BR /&gt;%mod(mod=5);&lt;BR /&gt;%mod(mod=6);&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 17:36:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258288#M49715</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-03-22T17:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Macro cycle 1 is fine, fails on cycle 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258303#M49722</link>
      <description>&lt;P&gt;Absolute speculation ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Purely a wild guess ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like you are willing to use a system of defining macros within another macro (usually frowned upon!).&amp;nbsp; Also, I imagine that you have simplified your code to make your question manageable in size.&amp;nbsp; So, what I suspect ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Within your system of macros calling macros, one of the macros redefines the meaning of %MOD.&amp;nbsp; So the second time, it means something totally different than what it did the first time.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 18:04:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258303#M49722</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-22T18:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro cycle 1 is fine, fails on cycle 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258306#M49724</link>
      <description>&lt;P&gt;I nest macros quite often....&amp;nbsp; *looks around questioningly...*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And no, it was a straight copy paste of the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you mean im redefining the meaning of %mod.&amp;nbsp; Where?&amp;nbsp; It's just used for the naming of files. I did re-try it, by changing the outer macro to %modx instead, wondering if using the same name for the macro and the macro var was causing it, but i still got the same error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;EDIT: The only part of the actual code i left out from the above copy were the values of &amp;amp;start and &amp;amp;end and the libnames.&amp;nbsp; 1978 and 2015.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 18:10:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258306#M49724</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-03-22T18:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Macro cycle 1 is fine, fails on cycle 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258324#M49730</link>
      <description>&lt;P&gt;I ran the code and was unable to replicate your error.&amp;nbsp; Could you run it again in a new SAS session and attach the new log?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 18:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258324#M49730</guid>
      <dc:creator>russt_sas</dc:creator>
      <dc:date>2016-03-22T18:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro cycle 1 is fine, fails on cycle 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258327#M49733</link>
      <description>&lt;P&gt;Weird, it didn't crash this time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cripes.&amp;nbsp; Ok, thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 18:54:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258327#M49733</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-03-22T18:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro cycle 1 is fine, fails on cycle 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258334#M49736</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71196"&gt;@MeganE﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Normally, this error message occurs only if you specify something in a macro call which SAS interprets as a positional parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examples:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%mod(mod=1,2);
%mod(mod=1,);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Typically in such cases, people try to pass a value containing a comma to a keyword parameter and forget to quote the comma or the entire value (e.g. by using the %STR function).&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 19:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-cycle-1-is-fine-fails-on-cycle-2/m-p/258334#M49736</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-22T19:12:24Z</dc:date>
    </item>
  </channel>
</rss>

