08-11-2016 01:34 PM - edited 08-11-2016 01:37 PM
Hi! I recently used some syntax you created for a match sase- control table for a question posted in 2012:
This seemed to work but I need some help troubleshooting.
1. The control id (ne_ssn) is duplicating and being used more than once. I want to be matched only once to a case (e_ssn).
2. Some cases are matched to over 200+ controls. I want to limit it to 5 matches.
3. I seems some of my cases are not appearing at all in my final table (e.g. 620K cases but final table only matched 600K cases). Does this mean there are no matches at all for the missing?
Any help is much apprecited!!
Here is my syntax:
proc sort data=tmp;
by service_entry_date study rand_num;
* 'study' variable is 1=case 0=control;
proc rank data=tmp out=tempR;
by service_entry_date study;
*assign random order;
create table exp2.match as
select a.ssn as e_ssn, a.service_branch as e_service_branch, a.sex as e_sex, a.service_entry_date as e_service_entry_date, a.study,
b.ssn as ne_ssn, b.service_branch as ne_service_branch, b.sex as ne_sex, b.service_entry_date as ne_service_entry_date, b.study
from tempr as a inner join tempr as b
on( a.service_entry_date between b.service_entry_date and b.service_entry_date_low) and a.service_branch=b.service_branch and
a.sex=b.sex and a.rand_num=ceil(b.rand_num/5)
where a.study and not b.study;
drop table tmp, tmpR;
08-11-2016 01:53 PM
"This seemed to work" but it clearly doesn't. Therefore, your problem must be different from the one posted in 2012.
Please post this question as a new topic with your description of the case-control matching rules and some test data.