DATA Step, Macro, Functions and more

Match firms with two sets of control firms

Occasional Contributor
Posts: 5

Match firms with two sets of control firms



I’m trying to match my ‘treatment’ dataset with two control datasets – control1 and control2. Here are the rules:

  1. I match treatment firms against control firms based on SIC2, fyear and the closest asset.
  2. Each treatment firm must have one match in 'control1' AND one match in 'control2'. In other words, matched treatment firms must have 2 control firms, selected from two groups. Any unmatched firm (even if it has one control from either group) should be deleted.
  3. My final result should append matched observations from all three groups (treatment, control1, and control2).
  4. In addition, there should be three columns indicating whether the observation is from treatment, control1 or control2.

In the attachment, I’ve some sample data along with my expected result. I highly appreciate your cooperation.

Super User
Posts: 5,876

Re: Match firms with two sets of control firms

Well this is whole application. And I don't think the communities are intended for business related application design and development.
Please try to outline the steps necessary and boil down any problems you might encounter to more specific questions.
Data never sleeps
Occasional Contributor
Posts: 5

Re: Match firms with two sets of control firms

[ Edited ]

Hi LinusH,


This is the part I've been struggling with. I do know how to match one treatment with one control but couldn't help myself with this problem - one treatment with two controls, where controls come from two different datasets. I hope someone here could help me out. SIC's and fyears are not necessarily required for the solution, which I think mitigates your concern about business related application. 

Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation