BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
Russ_SAS
SAS Alumni
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.

AI Navigator GIF.gif


Navigate AI governance with SAS tools for compliance and ethical AI practices. Try SAS Ai Navigator for free for the first six months.

Check it out on Microsoft Marketplace →

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1894 views
  • 0 likes
  • 3 in conversation