Hello everyone!
I am trying to propensity match a sample based on race as well as stratify this by age group. However, of my 8 groups, only the result for group 8 seems to be recorded by my loop. Can anyone help me troubleshoot?
I am currently using (based on http://repec.org/bocode/p/psmatch2.html):
Sample data below:
I am trying to propensity match a sample based on race as well as stratify this by age group. However, of my 8 groups, only the result for group 8 seems to be recorded by my loop. Can anyone help me troubleshoot?
I am currently using (based on http://repec.org/bocode/p/psmatch2.html):
Code:
g att = . egen g = group(strataage)
levels g, local(gr)
qui foreach j of local gr {
psmatch2 wnh blunt male teaching tclevel sbp if g==`j', out(emergentprocedure)
replace att = r(att) if g==`j' }
sum att
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(wnh strataage emergentprocedure blunt male teaching tclevel) int sbp 0 4 0 0 0 1 1 146 0 2 0 0 1 1 1 153 1 6 0 1 0 1 1 187 1 1 0 1 1 1 1 163 0 4 1 0 1 1 1 78 1 2 0 0 1 1 1 130 0 2 0 1 0 1 1 124 0 3 0 1 0 1 1 132 0 5 0 1 1 1 1 194 1 5 0 1 1 1 1 164 0 6 0 1 1 1 1 163 0 3 1 0 1 1 1 109 1 3 0 1 1 1 1 140 0 2 0 0 1 1 1 163 0 2 0 1 0 1 1 154 0 3 0 1 1 1 1 115 1 8 0 1 0 1 1 143 0 3 0 1 0 1 1 164 1 2 1 0 1 1 1 120 0 4 1 0 1 1 1 0 1 3 0 1 1 1 1 161 0 3 0 1 1 1 1 148 1 3 0 1 1 1 1 110 1 7 0 1 1 1 1 117 0 1 0 0 0 1 1 98 1 6 0 0 0 1 1 197 0 4 0 1 0 1 1 150 0 3 0 1 1 1 1 157 0 4 0 1 1 1 1 136 0 2 0 1 1 1 1 123 1 2 0 1 0 1 1 105 0 4 0 0 1 1 1 135 0 2 0 1 1 1 1 123 0 8 0 1 0 1 1 136 1 5 0 1 1 1 1 146 0 6 0 1 1 1 1 129 0 5 0 1 1 1 1 184 0 4 0 1 1 1 1 167 0 6 0 1 0 1 1 151 1 5 0 0 1 1 1 116 1 5 0 1 1 1 1 118 1 2 0 1 0 1 1 118 1 6 0 1 1 1 1 113 0 1 0 0 1 1 1 113 1 5 0 1 0 1 1 109 1 6 0 1 1 1 1 123 0 2 0 1 0 1 1 155 0 5 0 1 1 1 1 159 0 2 0 0 1 1 1 148 0 2 1 0 1 1 1 108 0 3 0 0 1 1 1 130 1 3 0 1 1 1 1 130 0 6 0 1 0 1 1 171 1 2 0 1 0 1 1 147 1 2 0 1 0 1 1 129 0 2 0 1 0 1 1 125 0 5 0 1 1 1 1 152 0 2 0 1 0 1 1 113 0 5 0 1 1 1 1 175 0 4 0 1 1 1 1 143 0 2 0 0 1 1 1 140 1 6 0 1 1 1 1 153 1 8 0 1 0 1 1 204 0 3 0 1 1 1 1 118 0 6 0 1 1 1 1 147 1 2 0 1 0 1 1 133 1 5 0 0 0 1 1 170 0 4 1 0 0 1 1 82 1 2 0 1 1 1 1 135 0 6 0 1 1 1 1 159 0 6 0 1 1 1 1 137 0 4 0 1 1 1 1 136 1 5 0 1 1 1 1 108 0 3 0 0 1 1 1 120 0 2 0 1 0 1 1 123 1 7 0 1 1 1 1 163 0 3 0 1 1 1 1 135 0 7 1 1 1 1 1 114 1 2 0 1 1 1 1 165 1 3 0 1 1 1 1 119 1 5 0 1 1 1 1 142 0 3 0 0 1 1 1 99 1 2 0 1 0 1 1 155 0 3 0 0 1 1 1 117 0 2 0 1 1 1 1 138 0 5 0 1 1 1 1 147 0 2 0 0 1 1 1 130 1 7 0 1 0 1 1 145 0 3 0 1 1 1 1 187 1 2 0 1 0 1 1 136 1 2 0 1 1 1 1 136 0 2 0 0 1 1 1 90 0 2 0 1 0 1 1 110 0 3 0 1 0 1 1 100 0 2 0 0 0 1 1 110 1 2 0 1 0 1 1 120 1 5 0 1 1 1 1 129 0 5 0 1 1 1 1 128 0 3 0 0 1 1 1 148 1 2 0 1 0 1 1 110 end
