Loop and mata - Foreach file doesn't work

#1
Hi
I could get this simple task to work
Code:
mat rama=J(17,3,.)

 forval j=1/17 {


quiet summ sexo [iw=fact] if b14_2_rev3n==`j'
local b14=r(sum_w)
matrix rama[`j',1]=`b14'


quiet summ sexo [iw=fact] if b14_1_rev3_caenes==`j'
local b14_1=r(sum_w)
matrix rama[`j',2]=`b14_1'

matrix rama[`j',3]=`b14'-`b14_1'

} 


mata
mrama = st_matrix("rama")
colsum(mrama)
colsum(mrama[.,3])

end
But when i try to run it over a list of files using the foreach command as this
Code:
cd C:\Users\JC\Bases\Stata

local filelist 2015_11ond.dta 2015_10son.dta 2015_9aso.dta  2014_8jas.dta 


foreach file of local filelist  {
use "`file'", clear


mat rama=J(17,3,.)

 forval j=1/17 {


quiet summ sexo [iw=fact] if b14_2_rev3n==`j'
local b14=r(sum_w)
matrix rama[`j',1]=`b14'


quiet summ sexo [iw=fact] if b14_1_rev3_caenes==`j'
local b14_1=r(sum_w)
matrix rama[`j',2]=`b14_1'

matrix rama[`j',3]=`b14'-`b14_1'

} 


mata
mrama = st_matrix("rama")
colsum(mrama)
colsum(mrama[.,3])

end



}
I receive this message:
Code:
 14. mrama = st_matrix("rama")
 15. colsum(mrama)
 16. colsum(mrama[.,3])
 17. 
. end
--Break--
r(1);

end of do-file

--Break--
r(1);
Can you tell me what's wrong with this DO file?
I'm a bit lost.
Thanks for your replies and time.