主题:[讨论]求助数据格式转换
请问如何将
study_id control_id
216 314
216 2024
217 16
217 78
497 584
497 857
转化为下面的数据格式
match case id
1 1 216
1 0 314
1 0 2024
2 1 217
2 0 16
2 0 78
3 1 497
3 0 584
3 0 857
一位朋友做了一个程序模板,但有问题,请问该怎么转换?
下面是朋友的程序:
create matchedcase;
(match n(3),;
case n(1),;
id n(4))
sele study_id dist from oldmatch into array caseids
caseCNT =alen(caseids)
use oldmatch
for i=1 to caseCNT
go 1
scan for case_ID=caseids(i)
insert into matchedcase (match case id) values (i,1,case_id)
insert into matchedcase (match case id) values (i,0,control_id)
end scan
end for
study_id control_id
216 314
216 2024
217 16
217 78
497 584
497 857
转化为下面的数据格式
match case id
1 1 216
1 0 314
1 0 2024
2 1 217
2 0 16
2 0 78
3 1 497
3 0 584
3 0 857
一位朋友做了一个程序模板,但有问题,请问该怎么转换?
下面是朋友的程序:
create matchedcase;
(match n(3),;
case n(1),;
id n(4))
sele study_id dist from oldmatch into array caseids
caseCNT =alen(caseids)
use oldmatch
for i=1 to caseCNT
go 1
scan for case_ID=caseids(i)
insert into matchedcase (match case id) values (i,1,case_id)
insert into matchedcase (match case id) values (i,0,control_id)
end scan
end for