BookmarkSubscribeRSS Feed
saf_sas
Calcite | Level 5

Hello,

 

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.

2 REPLIES 2
LinusH
Tourmaline | Level 20
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
saf_sas
Calcite | Level 5

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. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1452 views
  • 0 likes
  • 2 in conversation