Any leads on macro program to repeat the value for 'n' times? Assume I have the macro variables called 'name' and 'n'. If the value is 'David' and '100' then I want the name to print 100 times in the log.
Desired Output: 100 times value of name should be printed.
Sorry, off-by-one error below. I hate that the developer of REPEAT() thought it should return the first argument n+1 times. So to have David appear 100 times, you need:
%put %sysfunc(repeat(&name,&n-1)) ;
There is a REPEAT function, so you can do it without a macro:
%let name=David ; %let n=100 ; %put %sysfunc(repeat(&name,&n)) ;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.