Statistical Procedures

Programming the statistical procedures from SAS
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 739 views
  • 0 likes
  • 2 in conversation