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

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.

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