This shows how to loop a delimited macrovariabel.
%let Delimitor = ¤;
%let Logins = Login1¤Login2;
%let NumberOfLogins = %sysfunc(countw(&Logins., &Delimitor.));
%put Number of logins: &NumberOfLogins.;
%macro _CreateLogin;
%do J=1 %to &NumberOfLogins;
%let Login = %scan(&Logins., &J, &Delimitor.);
%CreateLogin(_Login=&Login.);
%end;
%mend;
%_CreateLogin;
A couple of suggestions:
1) Avoid using a language which is so shitty that it doesn’t even have a foreach loop.
2) If you can’t avoid SAS then avoid creating global variables like delimitor and logins. Instead pass the values as parameters.