BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
xiangpang
Quartz | Level 8

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.

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

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

2 REPLIES 2
art297
Opal | Level 21

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

 

xiangpang
Quartz | Level 8

Thanks, I remove it and the error gone. 

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
  • 887 views
  • 0 likes
  • 2 in conversation