I have a dataset containing treatment and control firms. Each firm belongs to a technology class defined in patentclass and innovation output of each firm is defined in patents which is a count data.
I want to match the control firms with treatment firms based on two criteria:
1) both treatment and control firm should be in the same patentclass
2)
Control firms should have the same innovation output level based on patents. But I don't want to limit the match based on rage, I want to match with the firm with the closest match of patents

I can think of the following code but not sure how to include that restriction of closest match in patent matching.:

cem patentclass(#0) patent, treatment(treatment)

Any help is appreciated.

thanks