SAS中文论坛

标题: 关于sas语法问题疑问? [打印本页]

作者: shiyiming    时间: 2006-4-20 12:36
标题: 关于sas语法问题疑问?
我是sas初学者,别人给我写了一个sas程序,但是里面我只懂sas基本语法,稍微复杂的就不懂了。下面是程序,谁能帮我解释一下,关键是百分号是什么意思,还有macro,call symput,是什么意思啊,或者谁有关于这方面的详细的资料啊?麻烦穿给我吧,我的mail:atomdust@163.com,有点急,多谢了!
=====================================
%macro product(aa=,bb=);
proc sql;
create table c as
select intercept as intercept, x1*y1 as z1 %do i=2 %to 8;,x&i*y&i as z&i %end;
from &aa,&bb;
quit;
%mend;

%macro logistic(data=,dv=,iv=,num=,dnum=,test=);
/* data means what you want do satatistical test on*/
/* dv and iv means dependent variable and independent variables*/
/* dnum is used to specify how many dependant variables includes, like
/*x1 x2 x3...x8, where there are 8 variable and setting dnum=8*/
/* test is dataset, based on which you get predicted yi.*/

data _null_;
iv2 = tranwrd(compbl("&iv"), " ", "+");
dv2 = tranwrd(compbl("&dv"), " ", "+");
call symput('iv2', iv2); /* independant variables array, like weight len...'*/
call symput('dv2', dv2);
run;

%do i=1 %to &dnum;
%let dvv&i=%scan(&dv2,&i,+);
%end;

%do i=1 %to #
%let ivv=%scan(&iv2,&i,+);
proc logistic data=&data outest=estimates;
/* estimated coefficienct stored on dataset estimates;*/
model &ivv=&dvv1-&&dvv&dnum /selection=forward;
run;

data estimates(keep=&dvv1-&dvv2,intercept);
set estimates;
run;
/* keep coefficient for dv and intercept in dataset estimates;*/

%product(aa=estimates,bb=test);
proc sql;
create table y&i as
select z1+z2+z3+z4+z5+z6+z7+z8 as y;
/* where there should be on simplied expression instead of z1+...z8*/
from c;
quit;
%end;
%mend;
作者: shiyiming    时间: 2006-4-20 15:44
标题: 回复
%定义宏




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2