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

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