/*请教大牛,如何在Macro中再嵌套一个Macro?*/
%macro test;%do i=2006 %to 2013;
data year&i.;set grade;
run;
%macro pct(point);
proc univariate data=year&i.;
var grade;
output out=pct pctlpts=&point pctlpre=p;
run;
proc print data=pct;
run;
%mend pct;
%pct(10 20 30 40 50 60 70 80 90 100);
proc sql;create table &i. as select distinct
*
from
year&i.,pct;
quit;
data t&i.;set t1;
if grade<p10 then high=1;
else ifp10<=grade<p20 then high=2;
else ifp20<=grade<p30 then high=3;
else ifp30<=grade<p40 then high=4;
else ifp40<=grade<p50 then high=5;
else ifp50<=grade<p60 then high=6;
else ifp60<=grade<p70 then high=7;
else ifp70<=grade<p80 then high=8;
else ifp80<=grade<p90 then high=9;
else ifp90<=grade then high=10;
if grade=. then high=.;
run;
%end;%mend;%test;