BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
smoore3790
Fluorite | Level 6

I am trying to match based on gender and facility, but am running into trouble with repeated controls. Is there a way to specify that each control observation can only be picked once so I don't wind up with repeats? This is what I have so far and my dataset looks somewhat like this

 

MRN    Gender     Facility

1            1              facility1

2            0              facility2

  

PROC SQL;
CREATE table controls_id
as select
one.Gender as control_Gender,
two.Gender as case_Gender,
one.Facilitys as control_fac,
two.Facilitys as case_fac,
FROM control one, cases two
where ( one.Facilitys=two.Facilitys and one.Gender=two.Gender);


proc sort data =controls_id out=controls_ids;
by control_id case_id ;
run;

 

proc surveyselect data=controls_ids method=srs n=3 out=caseids;
strata control_id ;
SAMPLINGUNIT case_id;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Zard
SAS Employee

Try adding the NODUPKEY option in the PROC SORT. Does that fix it?

View solution in original post

1 REPLY 1
Zard
SAS Employee

Try adding the NODUPKEY option in the PROC SORT. Does that fix it?

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 635 views
  • 0 likes
  • 2 in conversation