Hi:
Well, I have a disconnect between the example you originally posted and the macro code that you posted just now. In the original example, your code implied that the macro program was returning 1 value:
[pre]
data test1;
set test2;
value1=%my_macro(value_in_test2);
run;
[/pre]
Which would argue for PROC FCMP and a user-defined function definition.
But in the macro you just showed (%AUC_hyper_), the macro program has a DATA step, a PROC SUMMARY step which creates WORK.P1 and then a PROC PRINT on dataset P1). Where did you envision the variable VALUE1 would get a value FROM???? From WORK.P1??? From WORK.F1???
What is $ORDER??? Where do the values for &N and &HBOUND come from???
Conceptually, you would be asking the macro facility to do something like this:
[pre]
data test1;
set test2;
value1 =
insert ALL the code from
%AUC_hyper_(a,b,n,hBound, order ) macro program
;
run;
[/pre]
...which just will NOT work. Now, if you want to iterate through every observation in SET WORK.TEST2 and invoke the %AUC_hyper_ for every observation in WORK.TEST2, then you will want to read about the CALL EXECUTE method of placing macro code in the program stack and you will REALLY have to understand the timing issues of using CALL EXECUTE (such as the CALL EXECUTE will execute AFTER the DATA TEST1 step executes).
However, before you go down the CALL EXECUTE road, you might want to read and then search for more papers like these about calculating the area under the curve. A cursory review of some of these papers reveals that many folks have used SAS macros for performing this AUC task:
http://www2.sas.com/proceedings/sugi27/p229-27.pdf
http://www2.sas.com/proceedings/sugi27/p226-27.pdf
http://www.lexjansen.com/wuss/2004/posters/c_post_the_sas_calculations_.pdf
http://statcompute.spaces.live.com/blog/cns!39C8032DBD1321B7!583.entry
http://sphhp.buffalo.edu/biostat/research/techreports/UB_Biostatistics_TR0903.pdf
http://www.nesug.org/proceedings/nesug06/an/da29.pdf
http://www2.sas.com/proceedings/sugi28/275-28.pdf
http://www2.sas.com/proceedings/forum2008/231-2008.pdf
and at support.sas.com, these notes:
http://support.sas.com/kb/25/018.html
http://support.sas.com/kb/25/017.html
and the last note says:
NOTE: Beginning in SAS 9.2, comparison of areas under correlated ROC curves can be done using the ROC and ROCCONTRAST statements in PROC LOGISTIC. See the PROC LOGISTIC documentation for details and examples.
{endquote}
Perhaps some of the above will get you started on your task.
cynthia