Code:
. sysuse auto, clear (1978 Automobile Data) . . qui ivreg2 price (weight=length) i.turn headroom, cluster(turn) small . display e(inexog) 31b.turn 32.turn 33.turn 34.turn 35.turn 36.turn 37.turn 38.turn 39.turn 40.turn 41.turn 42.t > urn 43.turn 44.turn 45.turn 46.turn 48.turn 51.turn headroom . local x = "`e(inexog)'" . display "`x'" 31b.turn 32.turn 33.turn 34.turn 35.turn 36.turn 37.turn 38.turn 39.turn 40.turn 41.turn 42.t > urn 43.turn 44.turn 45.turn 46.turn 48.turn 51.turn headroom . . cap prog drop pretend_to_be_ivreg2 . prog pretend_to_be_ivreg2, eclass 1. ereturn local cmd = "ivreg2" 2. ereturn local inexog = "`x'" 3. end . display "`x'" 31b.turn 32.turn 33.turn 34.turn 35.turn 36.turn 37.turn 38.turn 39.turn 40.turn 41.turn 42.t > urn 43.turn 44.turn 45.turn 46.turn 48.turn 51.turn headroom . . qui ivreghdfe price (weight=length) headroom, absorb(turn) cluster(turn) // coeff/SE: 4.509 > 739 .7761883, Fstat: 69.125 . display e(cmd) ivreghdfe . display e(inexog) headroom . pretend_to_be_ivreg2 . display e(cmd) ivreg2 . display e(inexog) // DOES NOT WORK . .
Code:
. cap prog drop pretend_to_be_ivreg2 . prog pretend_to_be_ivreg2, eclass 1. ereturn local cmd = "ivreg2" 2. ereturn local inexog = "31b.turn 32.turn 33.turn 34.turn 35.turn 36.turn 37.turn > 38.turn 39.turn 40.turn 41.turn 42.turn 43.turn 44.turn 45.turn 46.turn 48.turn 51.turn he > adroom" 3. end . qui ivreghdfe price (weight=length) headroom, absorb(turn) cluster(turn) // coeff/SE: 4.509 > 739 .7761883, Fstat: 69.125 . display e(cmd) ivreghdfe . display e(inexog) headroom . pretend_to_be_ivreg2 . display e(cmd) ivreg2 . display e(inexog) // NOW, IT WORKS 31b.turn 32.turn 33.turn 34.turn 35.turn 36.turn 37.turn 38.turn 39.turn 40.turn 41.turn 42.t > urn 43.turn 44.turn 45.turn 46.turn 48.turn 51.turn headroom .
0 Response to Changing an estimation stored macro with a previously stored macro
Post a Comment