全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1383 0
2017-09-05

/*请教大牛,如何在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;


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群