proc sql;
create table s200701 as select cust_id from from a where open_date>mdy(12,31,2006) and mdy(2,1,2007)>open_date
quit;作者: shiyiming 时间: 2010-6-4 00:11 标题: Re: 请教 [code:2ga41rf3]data a;
do open_date = '01jan2007'd to '01jan2009'd;
cust_id = put(round(1000*ranuni(1), 1e2), z4.);
output;
end;
format open_date date11.;
run;
%macro out(ss);
data &ss;
set a(where =( 's'||put(year(open_date), 4.)||put(month(open_date),z2.) = "&ss"));
%mend out;
proc sql;
create table aa as
select distinct 's'||put(year(open_date), 4.)||put(month(open_date),z2.) as y
from a where not missing(open_date);
quit;
data _null_;
set aa;
call execute('%out('|| y||')'); run;
run;[/code:2ga41rf3]
程序的效率有点问题 JingJu。