Help using Base SAS procedures

how to solve the matching with replacement problem

Reply
Occasional Contributor
Posts: 5

how to solve the matching with replacement problem


                                                           Matching with replacement   /  Matching without replacement

Test firm                                             Matching firm

   sic year         

A  22  2009    Size=$42billion             C 22 2009 Size=41billion  /  C 22 2009 Size=41billion

B  22  2009    Size=$40billion             C 22 2009 Size=41billion  /  D 22 2009 Size=41.5 billion

To create a matched sample, I need to find a matched firm for 'A' and another for 'B'. If I'm matching on specific year (2009), I need to find with closest to 50billion for 'A' from the same sic code in 2009. Again the same for 'B'

I give an simple example of 'Matching with replacement' and 'Matching without replacement'. My desire output is 'Matching without replacement'

This means that once SAS program finds a matched firm, it cannot use the same firm to be matched another test firm. (in the same fiscal year & same sic code).

PROC SQL;
create table matching1  as
select a.*, b.*, abs(a.size - b.sizes) as diff
from mergedata_6 a, mergedata_5 b
where a. fyear = b. fyr and a. sic = b. sic1
group by b.fyr ,b.sic1, b.ciks
having calculated diff=min(calculated diff);
PROC print data=matching1;
run;

However, my SAS code just works as 'Matching with replacement' case. Please give some help for solving this problem.

Best,
Steve

Super User
Super User
Posts: 6,502

Re: how to solve the matching with replacement problem

Search for propensity score matching.  There are a number of macros available online.

Ask a Question
Discussion stats
  • 1 reply
  • 311 views
  • 3 likes
  • 2 in conversation