Unfortunately, -stci- does not seem to return its results when used
with the -group()- option. However, here's a quick wrapper that post
the results in e() so that they can be tabulated/exported using
-estout- or -esttab- (type -ssc install estout- to install these
commands).
*** mystci.do ***
capt prog drop mystci
prog mystci, eclass
*! version 1.0.0 13sep2008 Ben Jann
version 9.2
syntax [if] [in] [ , by(varname) Median Rmean Emean p(str) * ]
local stat "p50"
if `"`p'"'!="" local stat `"p`p'"'
else if "`rmean'"!="" local stat "rmean"
else if "`emean'"!="" local stat "emean"
tempname b V N_sub lb ub
marksample touse
if "`by'"!="" {
qui levelsof `by' if `touse', local(levels)
}
else {
local by `""total""'
local levels `""total""'
}
gettoken l rest : levels, quotes
while (`"`l'"'!="") {
qui stci if `touse' & `by'==`l', `median' `rmean' `emean' `p' `options'
mat `b' = nullmat(`b'), r(`stat')
mat `V' = nullmat(`V'), r(se)^2
mat `N_sub' = nullmat(`N_sub'), r(N_sub)
mat `lb' = nullmat(`lb'), r(lb)
mat `ub' = nullmat(`ub'), r(ub)
gettoken l rest : rest
}
foreach m in b V N_sub lb ub {
mat coln ``m'' = `levels'
}
if matmissing(`V') {
mat `V' = `b'' * `b' * 0 // set V to zero
}
else {
mat `V' = diag(`V')
}
eret post `b' `V'
eret matrix N_sub = `N_sub'
eret matrix lb = `lb'
eret matrix ub = `ub'
eret local cmd "mystci"
end
webuse page2
stci
mystci
estout, cell("N_sub b se lb ub")
stci, by(group)
mystci, by(group)
estout, cell("N_sub b se lb ub")
esttab using test.rtf, cell("N_sub b se lb ub") replace ///
nogap noobs nonumbers nomtitle
*** end ***
The last command generates a RTF file.
Best,
ben
On Sat, Sep 13, 2008 at 4:59 PM, moleps islon <[email protected]> wrote:
> Dear fellas,
> I use -stci, by(chemo)- and yield the following table
>
> | no. of
> rtchemo | subjects 50% Std. Err. [95% Conf. Interval]
> -------------+-------------------------------------------------------------
> no adjuv | 21 .24 .0139149 .1 .34
> rt alone | 41 .54 .0248576 .39 .65
> chemothe | 3 .67 .045771 .13 .
> rt + che | 16 1.3 .0221408 .88 2.02
>
> Is there an easy way for me to get this into a table rtf formatted ??
> Stata doesnt calculate the upper limit of the chemothe group . Any
> idea why - stata displays the lower boundary?
>
> Regards,
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/