一针见血~但是我们做流行病学研究时,遇到的更多是像缘梦缘楼主所描述的情况,都是等资料收集好了,再配对,这理论不是与实际相违背?作者: xinli 时间: 2010-11-13 12:22
相应的SAS程序是怎么操作的?作者: 缘梦缘 时间: 2010-11-21 17:22
data temp;
input id group age;
cards;
1 1 50
2 1 27
3 1 26
4 0 49
5 1 49
6 0 48
7 0 25
;
run;
proc sql;
create table comp as
select a.id as ida, a.group as groupa, a.age as agea,
b.id as idb, b.group as groupb, b.age as ageb,
abs(b.age-a.age) as gap_age
from (select * from temp where group=1) as a,
(select * from temp where group=0) as b
where (ageb-agea) between -5 and 5
;
quit;
proc sort data=comp;
by idb;
run;
data comp;
set comp;
by idb;
n=first.idb;
run;
proc sort data=comp;
by ida;
run;
data comp;
set comp;
by ida;
m=first.ida;
run;
data comp(keep=ida agea idb ageb gap_age);
set comp;
if n=m;
run;
/*A :试验组 B:对照组 gap_age:年龄差*/作者: wangming 时间: 2010-11-22 10:31 回复 缘梦缘 的帖子
It is too complicated. I am concern that maybe someone will be confused. You'd better to compiled your program as a macro. 作者: su2005 时间: 2011-1-14 20:08 回复 缘梦缘 的帖子