I would like to create a macro varialbe which contains repeated '$my_p' 100 times separated by space, the output should look like $my_P $my_p $my_P
I use the following, but it is not separated by space though
%let my_format=%sysfunc(repeat($my_P ,3));
%put my_format=&my_format;
Result:
my_format=$my_P$my_P$my_P$my_P
How to make this work, and any other ways?
add a space to your macro variable?
It did not work though. How?
%let my_format=%sysfunc(repeat(%str( )$my_P ,3));
%put my_format=&my_format;
Hello,
A macro solution:
%macro a(concvar, reptimes);
%global resvar;
%let resvar=;
%do i=1 %to &reptimes;
%let resvar=&concvar &resvar;
%end;
%mend a;
%a($my_P, 5)
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.