|
dxystata already gave the command, you can do, will get you close to ehat you want, then output to excel and format. Otherwise, using stata, you may have to use "file" related output to bold and format.
keep if num <= 10
tab num, matrow(num)
tab name num [fw=value], matrow(name) matcell(value)
local order "4 2 5 7 10 9 6 1 3 8"
drop _all
svmat name
gen name=string(name1)
drop name1
svmat value
local nrow = rowsof(num)
local nn = _N+1
set obs `nn'
gen _v=1
replace _v=-9 in l
local vs ""
forv i=1/`nrow' {
local ii : word `i' of `order'
replace value`i' = . if value`i' == 0
local vs "`vs' value`ii'"
replace value`i' = `i' in l
}
order name `vs'
replace name="name/num" in l
sort _v, stable
drop _v
export excel format.xlsx, replace missing(". (missing)")
|