I have folders as F_001 , F_002, F_003, F_004, F_005, F_011
and each folder has Data_1 , Data_2, Data_3, Data_4, Data_5, Data_10
if i give prompt x as 1,3,4 it should count the number of arguments in the macro x now macro x has 3 arguments so it should loop
three times .
PROMPT FORMAT X= 1,3,4
%macro test(type);
%let type = c; /* first find whether the delimiter is comma seperated
%if index(&x,',') > 0 %then %do;
%let n = %sysfunc(countw(&x,',');
%do k=1 %to &n ; / * will loop three times one for x=1 and then x=3 and then x=4 */
%let start = %substr(&x,&k,1); %let end = %substr(&x,&k,1);
%do pt = &start %to &end; / * In this case start will be 1 and end will be 1 as its looping for first time */ %let folder_name = F_00&pt; %if &pt ge 10 %then %do; %let folder_name = F_0&pt; /* (here folder_name resolves to F001) */ %end; %test2(&folder_name,&type);
%end;
%end;
Please Suggest me correct syntax as above code is not working but concept is same
... View more