BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ballardw
Super User

A not uncommon problem with loop codes in macros can also be the scope of loop counter when one macro calls another.

Something like this could have accidentally incremented your loop counter one too many times.

%macro one ();
%do i= 1 %to 4;
%two
%put in macro one i is &i.;

%end;
%mend;
%macro two ();
%do i= 1 %to 5;
%put in macro two i is &i.;
%end;
%mend;
%one;

Note that the log shows a value of 6 for the macro variable &I even though neither loop explicitly uses it. So if you had an inner loop using the same range of 1 to 19 the last value could have been 20 creating the nonexistent set name.

jacksonan123
Lapis Lazuli | Level 10
Yes, that was part of my problem and hopefully I will be more aware next
time.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 16 replies
  • 1642 views
  • 4 likes
  • 5 in conversation