data test; /* create a sample dataset */
format date date1 date2 yymmdd10. ;
date1 = input('20010101', yymmdd8.);
date2 = input('20051231', yymmdd8.);
do date = date1 to date2;
yearmonth= put(date, yymmn.);
do j= 1 to 3;
x = ranuni(123);
y = rannor(123);
output;
end;
end; drop date1 date2 j;
run;
proc sql;
create table ym as
select distinct yearmonth as yymm,
'd'||yearmonth as dout
from test;
quit;
data _null_;
set ym;
call execute('data '||dout||'; set test; IF yearmonth = '||yymm||'; RUN;');
run;