BookmarkSubscribeRSS Feed
devizeskayak
Calcite | Level 5
Hey Guys,
I'm consistently getting the following error: Macro keyword MEND appears as text. A semicolon or other delimiter may be missing.

I can get the macro to run by submitting the following string a few times:

*'; *"; *); */; %mend; run;

although once the macro has compiled, it produces a recursive reference error for the variable CLUST. IF someone would be willing to look at my code and let me know what they think is going wrong that would be great!

Cheers,
Ashton

%macro clusfinal (data = , clust=) ;
data clusdat1;
set &data;
if cluster ne &clust then mean1 = "."; run;
proc arima data = clusdat1;
identify var = mean1 (1);
run;
estimate p = 1 outest = autoclus'&clust' ;
RUN;
proc print data = autoclus;
run;
%mend;

%clusfinal (data = clusdata, clust =1);
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You need to share your SAS code execution (and compilation) as part of a complete SAS log, not just the code-piece you might think is related. Ensure that all code (including macros and macro variables) are revealed - such as using:

OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MLOGIC MPRINT;

In fact, this additional level of diagnostics may help you with desk-checking the code execution for culprit like open comment or missing semi-colon.

Scott Barry
SBBWorks, Inc.
Doc_Duke
Rhodochrosite | Level 12
For this line,

estimate p = 1 outest = autoclus'&clust' ;

you need to use double-quotes (") to get it to resolve to

estimate p = 1 outest = autoclus1;
devizeskayak
Calcite | Level 5
Thanks guys! got it resolved with the change from single quotes to doubles. Appreciate the help.

-A

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1574 views
  • 0 likes
  • 3 in conversation