I need to run the same macro CT 50 times changing just one of the several parameters. A, B, C...... are 50 variables that need to be replaced in the call macro.
%CT(param1=data, param2=inv, param3=A);
%CT(param1=data, param2=inv, param3=B);
%CT(param1=data, param2=inv, param3=C);
.....
I like Barry's 1st answer and below is how you would do for his second suggestion.
get the list of variables that needs to be passed to the macro and send them all to a macro variable separating them by a special character, say LIST for example:
the macro variable LIST would be like this A*B*C*D*............*Z
now loop it through all the parameters
%do i=1 %to 50;
%let param=%scan(&list,&i,'*');
%CT(param1=data, param2=inv, param3=¶m);
%end;
hope this helps.
Copy and paste works well
or consider using a macro do / while loop
I like Barry's 1st answer and below is how you would do for his second suggestion.
get the list of variables that needs to be passed to the macro and send them all to a macro variable separating them by a special character, say LIST for example:
the macro variable LIST would be like this A*B*C*D*............*Z
now loop it through all the parameters
%do i=1 %to 50;
%let param=%scan(&list,&i,'*');
%CT(param1=data, param2=inv, param3=¶m);
%end;
hope this helps.
You can have you parameters stored in a SAS table, and call the macro by using call execute instead.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.