BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have a dataset of cases (N=681) and I am trying to select a 1:2 cohort of matched controls from a dataset of ~20,000 eligible patients.

Both datasets contain the variables:
patient_id
surgery_date
age

I first want to match based on surgery date, selecting all eligible controls who had a surgery within 30 days (plus or minus) from the date each case had surgery.

Then, among those patients with a matched surgery date, I would like to select the two patients who were closest in age to the case (plus or minus) to serve as its controls. If there are multiple patients equally close in age to the case, I would like to use simple random sampling to select the controls from among them.

No control should be selected more than once; so although a patient may be eligible to serve as a control for more than one case, once a patient is selected as a control they need to be removed from the pool of eligible controls.

Can anyone help me write the syntax to select this matched cohort? I'm having quite a hard time figuring it out!!

Thanks so much!
1 REPLY 1
Doc_Duke
Rhodochrosite | Level 12
Perhaps these articles from SUGI will help

http://www2.sas.com/proceedings/sugi30/152-30.pdf
http://www2.sas.com/proceedings/sugi29/173-29.pdf

(BTW, I just googled
+sas select matched controls
to get an extensive list of approaches.)

I generally attack these "fuzzy matches" with PROC SQL. The "between" operator and "min" function make it pretty straightforward, though it does require a bit of fiddling.

Unless you need to do subsequent chart abstraction, using a 1:many match will increase your power without any increase in work.

Doc Muhlbaier
Duke

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

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