Dear Statalist users,

I am using the 'actest' command to conduct a serial correlation test after time-series regressions. However, I need to repeat the test 48 times (i.e., after each of the 48 regressions). So, I am trying to write a Stata code that generates the results automatically as follows:

matrix autocorr=J(48,7,.)
local i=1
forvalues j = 1/48 {
reg y x1 x2 x3 x4 if id==`j', robust
actest, r q0 lag(1/3)
matrix [`i',1]=(r(p))
i=`i'+1
}
matrix list autocorr

I get the message:
matrix operation not found
r(501);



I need help on how to fix the issue.

Thanks in advance for your reply.

Emna