DATA Step, Macro, Functions and more

problem with macro!

Reply
N/A
Posts: 0

problem with macro!

Thanks for the help. I used the /* */ and I still get the same error message. Here is my code and the log error that follows. In a Macro does my if-then statement take a different format?

%macro Split(varname=);
/***Ever ***/
if (grup=1 and f&varname ge 1) then &varname.m=1;
else if (grup=1 and g&varname ge 1) then &varname.m=1;
else if (grup=1 and h&varname ge 1) then &varname.m=1;
%mend;
%Split(varname=mim);
run;

ERROR MESSAGE:
1420 %Split(varname=lbw);
NOTE: Line generated by the invoked macro "SPLIT".
1 if (grup=1 and f&varname ge 1) then &varname.m=1;
--
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: Line generated by the invoked macro "SPLIT".
1 else if (grup=1 and g&varname ge
----
180
1 ! 1) then &varname.m=1; else if (grup=1 and h&varname ge 1) then &varname.m=1; else if

ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: Line generated by the invoked macro "SPLIT".
1 else if (grup=1 and h&varname ge 1) then &varname.m=1; else if (grup=2 and

----

180
1 ! d&varname ge 1) then &varname.m=1; else if (grup=2 and

ERROR 180-322: Statement is not valid or it is used out of proper order
Super Contributor
Super Contributor
Posts: 3,174

Re: problem with macro!

Again, you are not sharing your COMPLETE SAS code that is enter entered or generated from other SAS code. I do not see a %MEND statement, specifically.

Scott Barry
SBBWorks, Inc.
SAS Employee
Posts: 9

Re: problem with macro!

You are using DATA step statements such as IF so you must invoke the macro from within a DATA step or a DATA statement must be contained within the macro.
Ask a Question
Discussion stats
  • 2 replies
  • 124 views
  • 0 likes
  • 3 in conversation