03-22-2016 01:36 PM
I'm trying to run this code and it runs through the mod=1 cycle just fine. No errors. But the minute it gets to %mod(mod=2), then it says:
ERROR: All positional parameters must precede keyword parameters.
/*Add three variables from the PayerOnESRD dataset to the ALL $Ds and split out for M and N.*/
%do year4=&start. %to &end.;
%let yr = %eval(%substr(&year4,3,2));
create table &lib..inc_&mod.y&yr. as
b.esrdpaystat as paystat,
b.&chgdt. as paychgdt,
b.&chgtype. as paychgtype
from ialld.in_&mod.y&yr. a left join pay.payeronesrd b
%splitd(lib=imd, type=M, chgdt=M2NMChgDt, chgtype=m2nmchgtype);
%splitd(lib=inmd, type=NM,chgdt=NM2MChgDt, chgtype=nm2mchgtype);
03-22-2016 02:04 PM
Absolute speculation ...
Purely a wild guess ...
It looks like you are willing to use a system of defining macros within another macro (usually frowned upon!). Also, I imagine that you have simplified your code to make your question manageable in size. So, what I suspect ...
Within your system of macros calling macros, one of the macros redefines the meaning of %MOD. So the second time, it means something totally different than what it did the first time.
03-22-2016 02:08 PM - edited 03-22-2016 02:10 PM
I nest macros quite often.... *looks around questioningly...*
And no, it was a straight copy paste of the code.
What do you mean im redefining the meaning of %mod. Where? 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.
EDIT: The only part of the actual code i left out from the above copy were the values of &start and &end and the libnames. 1978 and 2015.
03-22-2016 03:12 PM
Normally, this error message occurs only if you specify something in a macro call which SAS interprets as a positional parameter.
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).
Need further help from the community? Please ask a new question.