BookmarkSubscribeRSS Feed
Fluorite | Level 6



I have a dataset with 87 cases and 1000's of controls. I want to match 2:1 with out replacement for the controls. I want to match on year of procedure (+/- 2 years), diagnosis (which can have 6 different values) and sex. I have searched through many papers online which did not remove duplicate controls. 



As well as the above paper which also did not remove duplicates.


I am trying the following code

DATA cases controls;
SET cohort3;
IF fvii_inclusion = 1 THEN OUTPUT cases;
ELSE OUTPUT controls;
data control2;
set controls;
proc sql;
create table controls_id
as select
one.uniqueid as case_id,
two.uniqueid as control_id,
one.timet as case_time,
two.timet as control_time ,
one.proc as case_proc,
two.proc as control_proc, as case_sex, as control_sex,

from cases one, control2 two
where ((one.timet between two.time_low and two.time_high) and ( and one.proc=two.proc) ;


I also reviewed the suggestions on hash tags for a similar problem posted but it changed nothing.


HELP much appreciated!

Fluorite | Level 6

If you want to remove duplicate controls then could you try adding the distinct option in the select statement in your proc sql code? 

Then, if you want 2 controls per case, you could try proc surveyselect, something like:


proc surveyselect data=controls_id method=srs sampsize=2;

strata case_id;


Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1 like
  • 2 in conversation