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;
Hi,
Did you try the DQMATCH proc?
Thanks,
Audrey
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.
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
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.
Then you want this most likely.
https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.