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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 912 views
  • 0 likes
  • 3 in conversation