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.

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!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2481 views
  • 0 likes
  • 3 in conversation