How can I output the macro value to a dataset instead of using put to put to the sas log? I tried data rule; from = &A; output; to=&B; output; run; but it seems the recursion of the macro stop at the first iterate..... %MACRO TOH (N,A,B); %IF &N =1 %THEN %DO; /* want to output &A and &B to a data set here */ %ELSE %DO; %TOH(%EVAL (&N-1), &A, %EVAL(6-&A-&B)); %TOH(1,&A,&B); %TOH(%EVAL(&N-1),%EVAL(6-&A-&B), &B); %END; %MEND TOH; %MACRO TOH2; %LET A=1; %LET B=2; %DO N=1 %TO 5; data _null_; put "Number of disk = &N"; %TOH(&N, &A, &B); PUT "STR( )"; %END; %MEND TOH2;
... View more