m********1 发帖数: 368 | 1 向各位SAS IML达人请教一个SAS IML调用DATA step数据的问题。程序见下方。print
alpha beta可以正常输出,但是计算积分却报错,不知道是什么缘故?
注:我在写一个很复杂的宏,这是我简化的一个程序。我必须调用DATA eval里面的数
据,而不能直接在IML里面定义这些数据。
/* Define the Integrand in AUC Quaduature */
%MACRO TPR(FPR, alpha, beta);
1-1/(1+exp((log(&FPR./(1-&FPR.))+&alpha.)*exp(&beta./2)));
%MEND TPR;
DATA eval;
input alpha beta;
cards;
2.6728 -0.1220
;
RUN;
PROC IML;
use eval;
read all;
print alpha beta;
start fun(FPR);
TPR=%TPR(FPR, alpha, beta);
return(TPR);
finish;
/* Call QUAD */
bound = { 0 1 | i**f 发帖数: 1195 | 2 add global option when you define a module..
try this:
/* Define the Integrand in AUC Quaduature */
%MACRO TPR(FPR, alpha, beta);
1-1/(1+exp((log(&FPR./(1-&FPR.))+&alpha.)*exp(&beta./2)));
%MEND TPR;
DATA eval;
input alpha beta;
cards;
2.6728 -0.1220
;
RUN;
PROC IML;
use eval;
read all;
print alpha beta;
start fun(FPR) global(alpha,beta);
TPR=%TPR(FPR, alpha, beta);
return(TPR);
finish;
/* Call QUAD */
bound = { 0 1 };
call quad(AUC, "fun", bound) eps=1E-10;
print AUC;
QUIT; | i**f 发帖数: 1195 | | m********1 发帖数: 368 | 4 It works! And my original macro, which is very complex, also works!
Thank you very much for your help!
【在 i**f 的大作中提到】![](/moin_static193/solenoid/img/up.png) : add global option when you define a module.. : try this: : /* Define the Integrand in AUC Quaduature */ : %MACRO TPR(FPR, alpha, beta); : 1-1/(1+exp((log(&FPR./(1-&FPR.))+&alpha.)*exp(&beta./2))); : %MEND TPR; : DATA eval; : input alpha beta; : cards; : 2.6728 -0.1220
| m********1 发帖数: 368 | 5 By the way, How do you find where the problem is? And how long did it take you to
settle this problem?
【在 i**f 的大作中提到】![](/moin_static193/solenoid/img/up.png) : mitbbs又抽风了。。。
| i**f 发帖数: 1195 | 6 我编过IML所以知道啊...
you to
【在 m********1 的大作中提到】![](/moin_static193/solenoid/img/up.png) : By the way, How do you find where the problem is? And how long did it take you to : settle this problem?
|
|