Hi all,
I am trying to come up with control firms for treatment firms in the sample. It is a cross-sectional data, and I want one control firm (matched within the same industry code and closest propensity score) for each treatment firm. So, one-on-one matching for a treatment-control pair.
If firm B can act as a control firm for firm A (based on the criteria, i.e. same industry code and closest propensity), then it should not act as a control for any other firm. However, the next best alternative should be used as a control firm, i.e. within the same industry code, but the next best closest propensity score.
firm_id Treatment_indicator Industry_code Pscore
1111 0 11 0.35
1112 1 11 0.44
1113 0 12 0.60
1114 0 15 0.80
1115 1 17 0.56
After creating two separate files for treatment and control firms, I am using this code (I got it from previous posts):
data treatment_firms conrol_firms;
set have;
if treatment_indicator = 0 then output control_firms;
if treatment_indicator = 1 then output treatment_firms;
run;
proc sql;
create table like_each_other as
select O.*, T.firm_id as Tfirm_id, abs(O.pscore-T.pscore) as P_Diff
from control_firms as O inner join treatment_firms as T
on o.industry_code=t.industry_code
order by tfirm_id;
quit;
proc means data=like_each_other noprint;
by Tfirm_id;
output out=close_match idgroup(min(P_diff) out[1] (firm_id)=);
run;
Can you please help in coming up with the correct codes? These codes are working on 'with replacement' basis, so, one control firm is chosen as a 'control firm' for another treatment firm as well. I want one firm to act as a control for only one treatment firm.
Regards,
Aman
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.