DATA Step, Macro, Functions and more

Macro error message

Accepted Solution Solved
Reply
Contributor
Posts: 60
Accepted Solution

Macro error message

Hi all,

I made some codes including macro. They went well when I used last week, but I always found errors when using them this week

%macro try(missper,n_boot);
%MACRO mi(missper);

data rmse&missper;
		set rmse&missper;
		index = &i;
		
	run;
	%if &i=1 %then %do;
	data poolrmseem&missper rmse_old rmse&missper;
		set rmse&missper;
		index = &i;
		run;
	%end;
	%else %if &i>1 %then %do;
	data poolrmseem&missper;set rmse_old rmse&missper;run;
	data rmse_old;set poolrmseem&missper;run;
	%end;
%mend mi;
%mi(&missper);

   %let i=1;
   %do %until (&i>&n_boot);
	  %mi(&missper);
	  %let i = %eval(&i+1);
   %end;
%mend try;
%try (20, 5);

. Pretty weird!

I have listed the code and log message below. Could anybody help me to find out the reason? Thanks.

 

 

 

22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN
where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant,
a datetime constant, a missing value, INPUT, PUT.
WARNING: Apparent symbolic reference I not resolved.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.RMSE20 may be incomplete. When this step was stopped there were 0
observations and 5 variables.
WARNING: Data set WORK.RMSE20 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds


WARNING: Apparent symbolic reference I not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is
required. The condition was: &i=1
ERROR: The macro MI will stop executing.


Accepted Solutions
Solution
‎03-31-2018 11:52 PM
PROC Star
Posts: 8,145

Re: Macro error message

Posted in reply to xiangpang

Not weird! 

 

Why do you have 

%mi(&missper);

in your code before you begin the loop. SAS doesn't hasn't, at that point, created macro variable &i

 

If you remove that line the code does whatever it is doing.

 

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Solution
‎03-31-2018 11:52 PM
PROC Star
Posts: 8,145

Re: Macro error message

Posted in reply to xiangpang

Not weird! 

 

Why do you have 

%mi(&missper);

in your code before you begin the loop. SAS doesn't hasn't, at that point, created macro variable &i

 

If you remove that line the code does whatever it is doing.

 

Art, CEO, AnalystFinder.com

 

Contributor
Posts: 60

Re: Macro error message

Thanks, I remove it and the error gone. 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 152 views
  • 0 likes
  • 2 in conversation