Hi all,
I want to match bonds with the same company and credit rating. Therefore, I use a loop to perform psmatch2 in each group. However, I noticed that when running psmatch2 within the loop, the colomns of matching results, such as _id, _n1, and _weight, are not displayed. How should I modify the code to show these results?
Additionally, I would like to obtain the differences in independent variables(IndVar in my code) for the matched pairs. How should I proceed with this?
I want to match bonds with the same company and credit rating. Therefore, I use a loop to perform psmatch2 in each group. However, I noticed that when running psmatch2 within the loop, the colomns of matching results, such as _id, _n1, and _weight, are not displayed. How should I modify the code to show these results?
Additionally, I would like to obtain the differences in independent variables(IndVar in my code) for the matched pairs. How should I proceed with this?
Code:
egen firmrating = group(RefinitivTicker SumRatingScale)
g att= .
levels firmrating, local(gr)
foreach j of local gr {
capture psmatch2 Dummy V1 V2 V3 V4 V5 if firmrating == `j', out(IndVar)
* Check if there was an error (no observations)
if _rc != 0 {
di "Warning: No observations for group `j'"
}
else {
* Your additional code here, if needed
replace att = r(att) if firmrating == `j'
}
}

Comment