|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Re: display single value stored in e()
<>
You are welcome... Just make sure that the correct numbers get multiplied
when creating `mis', I am not much of an expert on -svy- stuff. I searched
in vain for a -matrix- containing the weighted counts...
HTH
Martin
_______________________
----- Original Message -----
From: "Eric A. Booth" <[email protected]>
To: <[email protected]>
Sent: Tuesday, May 19, 2009 11:12 PM
Subject: Re: st: Re: display single value stored in e()
Works great. Thanks.
On May 19, 2009, at 3:54 PM, Martin Weiss wrote:
<>
-quietly- call -svy: tabulate- again before proceeding to -esttab- - I
ahve also shortened the creation of your missings, by the way...
*****
webuse nhanes2b, clear
//create missing
replace sex = .a if uniform()<.25
//label variables
label def sex 0 "Female", modify
label def sex 1 "Male", modify
label def sex .a "MISSING", modify
label val sex sex
****
svyset psuid [pweight=weight], strata(stratid)
estpost svy: tabulate sex, /*
*/ count obs se // missing
//get missings
qui svy linearized : tabulate sex, miss count
mat A=e(Prop)
local mis = round(e(total)*A[3,1])
esttab using "`sourcefiles'weighted.csv", ///
cell(" count obs se cell") varlabels(`e(labels)') csv ///
addnotes(" `mis' ") replace
HTH
Martin
_______________________
----- Original Message ----- From: "Eric A. Booth" <[email protected]
>
To: <[email protected]>
Sent: Tuesday, May 19, 2009 9:45 PM
Subject: st: display single value stored in e()
>
>
I am trying to figure out how to display one value from a e() matrix/
scalar/etc. in the footnote of a esttab table.
For instance, if I run the commands below, I would like the
addnotes("") command to display the weighted number of missing values
( e(count) ) from the -estpost svy: tabulate- above. I realize that
including "missing" as a option for the -estpost svy: tabulate-
command would display the weighted count in the -esttab- table, but I
don't want the weighted count in the main table...it needs to lie in
the notes under the table. Any ideas?
******************************
webuse nhanes2b, clear
//create missing
gen random = uniform()*100
replace sex = . if random<25
recode sex (.=.a)
//label variables
label def sex 0 "Female", modify
label def sex 1 "Male", modify
label def sex .a "MISSING", modify
label val sex sex
****
svyset psuid [pweight=weight], strata(stratid)
estpost svy: tabulate sex, count obs se
esttab using "`sourcefiles'weighted.csv", ///
cell(" count obs se cell") varlabels(`e(labels)') csv ///
addnotes(" `e(count)' ") replace
******************************
Thanks,
Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754
*
* 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/
*
* 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/