BookmarkSubscribeRSS Feed
SteveLee
Calcite | Level 5


                                                           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

1 REPLY 1
Tom
Super User Tom
Super User

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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 1124 views
  • 3 likes
  • 2 in conversation