Here's my attempt with recursion: PROC FCMP outlib=work.functions.wrapper; subroutine combine(instr $, index, outstr $, fil); outstr1=outstr; if index = 0 then do; rc=fput(fil, outstr1); rc=fappend(fil); end; else do; n=lengthn(instr); do i = 1 to n; outstr1=catt(outstr1,substrn(instr,i,1)); call combine(instr, index-1, outstr1, fil); outstr1=substr(outstr1,1,length(outstr1)-1); end; end; endsub; subroutine combine_run(instr $, index); fil=fopen('f','O'); call combine(instr, index, '', fil); rc = fclose(fil); endsub; RUN; options cmplib=work.functions; filename f temp; data _null_; call combine_run('abcdef',8); run; data want; infile f; input; pass=_infile_; run; filename f clear;
... View more