|
|
Re: 如何在队列内 为病例随机选对照???
在这个程序下,如果我想增加一个筛选条件,比如是month_collect,是不是就如我下面程序中加的if语句,就好了??
我运行后,选出的对照不是正正好,不晓得是符合条件的少?还是加的这句if有问题?
%macro getPeers(code,low,up,low2,up2);
data candidate(keep=patientId code age ) noncancer(drop=patientid n);
set noncancer;
patientId=&code;
if &low<=age<=&up then
do;
[color=#FF0000:3hv881hu] if &low2<=month_collect<=&up2;[/color:3hv881hu]
n+1;
if n<=4 then output candidate;
else output noncancer;
end;
else output noncancer;
run;
proc datasets;
append base=final
data=candidate;
run;
%mend;
option nomprint;
proc datasets lib=work;
delete final;
run;
data _null_;
set cancer;
length cmd $200;
cmd='%getpeers('||code||','||age-2||','||age+2||','[color=#FF0000:3hv881hu]||month_collect-1||','||month_collect+1||')';[/color:3hv881hu]
call execute(cmd);
run |
|