- data a;
- input time yymmdd10. months;
- format time yymmdd10.;
- cards;
- 2015/01/01 4
- 2015/02/04 5
- 2015/02/07 6
- ;
- run;
- proc sql noprint;
- select count(*) into:nobs from a;
- quit;
- %macro test;
- %do obs=1 %to &nobs;
- data a;
- set a;
- if _n_=&obs then call symputx('tmax',months);
- run;
- %put &tmax;
- data a;
- set a;
- if _n_=&obs then do;
- %do i=1 %to &tmax;
- format t&i yymmdd10.;
- t&i=intnx('month',time,1,'sameday');
- %end;
- end;
- run;
- %end;
- %mend;
- %test