Hi
I could get this simple task to work
But when i try to run it over a list of files using the foreach command as this
I receive this message:
Can you tell me what's wrong with this DO file?
I'm a bit lost.
Thanks for your replies and time.
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
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
}
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);
I'm a bit lost.
Thanks for your replies and time.