BookmarkSubscribeRSS Feed
gizat
Calcite | Level 5
Dear SAS experts,
 

For my matched case-control study, I’m preparing my data for a conditional logistic regression.  Using the matching variables, I’ve got a dataset containing the details for cohort (cases and controls identified). At this stage I know my cases and the controls. However, I do not know which controls were matched to which case. I need to make risk sets or strata so that I can perform conditional logistic regression. 

 

Each case and control have unique identifying variable, I want to identify the controls matched to each case. Could you please help me how I can link the cases to their matched controls and assign them a specific id for each? My matching ration is 1:3.

 

Looking forward to hearing from you. 

Thank you,

 

2 REPLIES 2
smantha
Lapis Lazuli | Level 10
Do you know if the match variables overlap between cases. If not you can use the following logic. Group is the variable that has case or control values.
Proc sort data= have; by match1 match2 match3 group
Data want;
Set have;
By match1 match2 match3;
Retain caseno 0;
If first.match1 then caseno=caseno+1;
Run;
This works well only if match1 match2 and match3 are all discrete values and matches are exact. If you are doing a match on ranges you can split your have dataset into two datasets one containing all the records of cases only, and the other containing all records. Then do a sql join on both datasets.
gizat
Calcite | Level 5

Hi Smantha,

 

Yes, they do. I've three matching variables; age (+-2 years), gender (match same gender) and year of hospital admission (+-2 years). What I want is to choose three controls for per case among possible controls and want to identify the controls matched to each case. 

More help is appreciated!

 

Kind regards,

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 999 views
  • 0 likes
  • 2 in conversation