BookmarkSubscribeRSS Feed
lalaktgrau
Fluorite | Level 6

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;

5 REPLIES 5
audrey
SAS Employee

Hi,

 

Did you try the DQMATCH proc?

http://go.documentation.sas.com/?docsetId=dqclref&docsetVersion=9.4&docsetTarget=n1xjvmh658gp9mn1rl9...

 

Thanks,
Audrey

www.sas.comsupport.sas.com
SAS®... THE POWER TO KNOW®
lalaktgrau
Fluorite | Level 6

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.

Reeza
Super User

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...

lalaktgrau
Fluorite | Level 6

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.

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
  • 5 replies
  • 3658 views
  • 0 likes
  • 3 in conversation