DATA Step, Macro, Functions and more

Matching sample with control group on size and industry

Reply
Contributor
Posts: 23

Matching sample with control group on size and industry

Hi,

 

I am trying to do a 1 to 1 match. I did it the following way. The results were 2721 matches which I am confused about since my control observations are over 400,000 and trying to get one match for each of my 7,000 observations in my sample. Can anyone help me figure it out. Ultimately there should be 7,000 matches so there is a total of 14,000 individual observations. 

 

my data has gvkey (company identifier), fyear (fiscal year), sic (industry), TA (total assets)

 

proc sql;
create table want as
select s.*, c.gvkey as match_firm, c.AT as match_assets, c.fyear as match_year
from sample1 as s inner join control1 as c
on s.sic=c.sic
where c.gvkey ne s.gvkey
group by s.gvkey
having abs(s.AT-c.AT) = min(abs(s.AT-c.AT));
select * from want;
quit;

Esteemed Advisor
Posts: 5,611

Re: Matching sample with control group on size and industry

Why do you expect 14000 obs and not 7000?

PG
Contributor
Posts: 23

Re: Matching sample with control group on size and industry

I expect 7000 matches so 14,000 total observations ---- 7000 from my sample and 7000 from the control. Regardless, it doesnt make sense to have less than half. 

Esteemed Advisor
Posts: 5,611

Re: Matching sample with control group on size and industry

[ Edited ]

Possible causes that I can think of

 

Many sic have a single gvkey in the control dataset

Many AT values are missing in the sample dataset

Some sic in the sample do not occur in the control dataset

 

if none of those apply, I'm as puzzled as you are.

PG
Ask a Question
Discussion stats
  • 3 replies
  • 67 views
  • 0 likes
  • 2 in conversation