Hi Statalists,
I'd like to know the potential reasons why Mahalanobis distance matching might fail. I've segmented my sample into groups and aim to obtain Mahalanobis pairs within each group. However, I've noticed that some samples can't be matched.
My code is provided:
I'd like to know the potential reasons why Mahalanobis distance matching might fail. I've segmented my sample into groups and aim to obtain Mahalanobis pairs within each group. However, I've noticed that some samples can't be matched.
My code is provided:
Code:
egen grouping = group(A1 A2) g att= . levels grouping, local(gr) foreach j of local gr { capture psmatch2 Dummy if grouping == `j', mahal(B1 B2 B3 B4) out(Results) * Check if there was an error (no observations) if _rc != 0 { di "Warning: No observations for group `j'" } else { replace att = r(att) if grouping == `j' } }