BookmarkSubscribeRSS Feed
ErikLund_Jensen
Rhodochrosite | Level 12

Any processing of data sets in a loop that can run to iterations in the 6-digit range, will be ineffecient. But is the macro loop really necessary?

 

Basically your outer macro loops over all observations in your input data TESTCOMB2, stores the value of variable combos2 in macro variable changelist, and then calls the macro US13_TARGET_ANALYSIS, which takes the current value in the macro variable changelist as input and does something that results in one record, that is appended to an output data set TARGETMEANS2, so this data set finally has the same number of observations as the input data set.

 

Without knowing what is stored in the macro variable changelist, and what happens in the macro US13_TARGET_ANALYSIS, it is difficult to see if the loop and resulting appending can be avoided. But if it is possible to rethink the process and do the same in one data step with TESTCOMB2 as input and TARGETMEANS2 as output, it would run much faster. But you need to post an input sample and the whole macro US13_TARGET_ANALYSIS to get any further suggestions.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 15 replies
  • 2628 views
  • 2 likes
  • 7 in conversation