DATA Step, Macro, Functions and more

Creating Matched Pairs

Reply
New Contributor
Posts: 3

Creating Matched Pairs

Hi everyone,

 

I'm trying to create a dataset where I match subjects by age (+/- 1 yr), gender, and county. I would want the final dataset to have individual observations for each subject, with an additional matched ID variable that identifies each group.

 

How can I go about it??

 

When I do it using SQL, I end up with one observation with all the ids of everyone that has been matched.

 

proc sql;
create table matches_age as
select
a.id as v_id,
b.id as nv_id,
a.birth_yr as v_birth_yr,
b.birth_yr as nv_birth_yr,
a.county_2013 as v_county_2013,
b.county_2013 as nv_county_2013,
a.gender_cd as v_gender_cd,
b.gender_cd as nv_gender_cd,
b.rand_num as rand_num
from v a, nv2 b
where ((a.birth_yr between b.birth_yr_high and b.birth_yr_low)
and a.county_2013=b.county_2013 and a.gender_cd=b.gender_cd);
quit;

SAS Employee
Posts: 23

Re: Creating Matched Pairs

Posted in reply to lalaktgrau
New Contributor
Posts: 3

Re: Creating Matched Pairs

From what I'm reading, it seems like it's used to identify multiple observations of the same subject. I would want to match cases and controls with similar characteristics and assign each group of cases/controls a unique value.

Highlighted
Super User
Posts: 22,874

Re: Creating Matched Pairs

Posted in reply to lalaktgrau

What version of SAS do you have?

 

PROC PSMATCH is for probabilistic linkages and/or the Mayo Clinic matching macros?

 

PROC PSMATCH

https://support.sas.com/rnd/app/stat/procedures/psmatch.html

 

Mayo Clinic macros

http://www.mayo.edu/research/departments-divisions/department-health-sciences-research/division-biom...

New Contributor
Posts: 3

Re: Creating Matched Pairs

I have SAS 9.4 TS Level 1M2 X64_7PRO.

 

I don't want to do propensity score as in PSMATCH. 

 

I just want to select observations that have the same birth_yr, gender, and county and assign a unique number to it.

Super User
Posts: 22,874

Re: Creating Matched Pairs

Posted in reply to lalaktgrau
Ask a Question
Discussion stats
  • 5 replies
  • 146 views
  • 0 likes
  • 3 in conversation