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.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 15 replies
  • 884 views
  • 2 likes
  • 7 in conversation