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 Employee
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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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