Hi all,

I am new in this forum so if this is not the proper place to post this question let me know please.

I have to run some wald test after the margin commands. I have 10 different outcomes and I have to run 8 tests for each one of them. I am using a forevalues loop to run the tests in each outcome and it does work. The code is this:

ologit INCDECIL HWUSUAL gender sup exp NatISCED* EUcitISCED* nonEUcitISCED* EUresid nonEUcitresid

margins, predict (outcome(1)) dydx(NatISCED* EUcitISCED*) at(EUresid = 0 nonEUcitresid = 0 EUcitISCED1 = 0 EUcitISCED2 = 0 EUcitISCED3 = 0 EUcitISCED4 = 0 EUcitISCED5 = 0 EUcitISCED6 = 0 EUcitISCED7 = 0 EUcitISCED8 = 0 nonEUcitISCED1 = 0 nonEUcitISCED2 = 0 nonEUcitISCED3 = 0 nonEUcitISCED4 = 0 nonEUcitISCED5 = 0 nonEUcitISCED6 = 0 nonEUcitISCED7 = 0 nonEUcitISCED8 = 0) ///
post at(nonEUcitresid = 0 NatISCED1 = 0 NatISCED2 = 0 NatISCED3 = 0 NatISCED4 = 0 NatISCED5 = 0 NatISCED6 = 0 NatISCED7 = 0 NatISCED8 = 0 nonEUcitISCED1 = 0 nonEUcitISCED2 = 0 nonEUcitISCED3 = 0 nonEUcitISCED4 = 0 nonEUcitISCED5 = 0 nonEUcitISCED6 = 0 nonEUcitISCED7 = 0 nonEUcitISCED8 = 0)

forvalues i = 1/8 {
test [NatISCED`i']1._at - [EUcitISCED`i']2._at = 0
local sign_ag = sign([NatISCED`i']1._at - [EUcitISCED`i']2._at)
display "H_0: NatISCED`i' coef <= EUcitISCED`i' coef. p-value = " 1-normal(`sign_ag'*sqrt(r(chi2)))
}

I would like to include the input for margins into the loop so I can run it for outcome from 1 to 10 and inside each outcome run the test as it is specified in the forvalues loop. I would like to save on running the margin command ten times and afterword running my loop. Can I use several loops to do that? Any advise on how to do it.

Thank you in advance,
Carlos.