First time poster so hopefully my questions makes sense. I've been creating tabulations to export to excel using the putexcel command, which has gone smoothly using this syntax:
local startrow = `startrow' + 5
local startcol = `startrow' - 1
tabulate q2 q64c, matcell(freq) matrow(heatingfuel) col nofreq
mata: st_matrix("freq", (st_matrix("freq") :/ colsum(st_matrix("freq"))))
mat li freq , format("%3.2f")
putexcel A`startrow'=matrix(heatingfuel) B`startrow'=matrix(freq)
tabulate q64c, matcell(freq) matrow(hometype)
matrix list hometype
local cols = rowsof(hometype)
local col = 2
forvalues i = 1/3 {
local val = hometype[`i',1]
local val_lab : label (q64c) `val'
local temp=char(64+`col')
putexcel `temp'+`startcol'=("`val_lab'")
local col = `col' + 1
}
matrix list heatingfuel
local rows = rowsof(heatingfuel)
local row = 2
forvalues i = 1/`rows' {
local val = heatingfuel[`i',1]
local val_lab : label (q2) `val'
local temp= `startrow'
putexcel A`startrow'=("`val_lab'")
local row = `row' + 1
local startrow = `startrow' + 1
}
But now I am using the svy command to weight my survey and it appears that I can no longer use the matcell syntax that I was using to inform my matrices. I know I need to use something from the ereturn list to build my column proportions now, but I can't quite figure it out. I saw on another board to use something like this but it doesn't quite get me to the column proportions matrix that I would like to export to excel with the putexcel command:
matrix ct = e(N_pop)*e(Prop)
local startrow = `startrow' + 5
local startcol = `startrow' - 1
tabulate q2 q64c, matcell(freq) matrow(heatingfuel) col nofreq
mata: st_matrix("freq", (st_matrix("freq") :/ colsum(st_matrix("freq"))))
mat li freq , format("%3.2f")
putexcel A`startrow'=matrix(heatingfuel) B`startrow'=matrix(freq)
tabulate q64c, matcell(freq) matrow(hometype)
matrix list hometype
local cols = rowsof(hometype)
local col = 2
forvalues i = 1/3 {
local val = hometype[`i',1]
local val_lab : label (q64c) `val'
local temp=char(64+`col')
putexcel `temp'+`startcol'=("`val_lab'")
local col = `col' + 1
}
matrix list heatingfuel
local rows = rowsof(heatingfuel)
local row = 2
forvalues i = 1/`rows' {
local val = heatingfuel[`i',1]
local val_lab : label (q2) `val'
local temp= `startrow'
putexcel A`startrow'=("`val_lab'")
local row = `row' + 1
local startrow = `startrow' + 1
}
But now I am using the svy command to weight my survey and it appears that I can no longer use the matcell syntax that I was using to inform my matrices. I know I need to use something from the ereturn list to build my column proportions now, but I can't quite figure it out. I saw on another board to use something like this but it doesn't quite get me to the column proportions matrix that I would like to export to excel with the putexcel command:
matrix ct = e(N_pop)*e(Prop)
Comment