Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: display single value stored in e()


From   "Eric A. Booth" <[email protected]>
To   [email protected]
Subject   Re: st: Re: display single value stored in e()
Date   Tue, 19 May 2009 18:49:22 -0500

I also get the same results in the results window, but when I look at the csv file that -esttab- creates after your -qui svy linearized:- version of the do-file, the columns for 'count, cell, and obs' are all empty. When I run the do-file with -qui estpost svy:-, the output is there.
 -svy linearized- may not store the same estimates as -estpost svy- (?)


On May 19, 2009, at 4:59 PM, Martin Weiss wrote:

<>

Not sure what the modification does for you, but if it let`s you sleep well at night ... I get the same result for both command sequences...


HTH
Martin
_______________________
----- Original Message ----- From: "Eric A. Booth" <[email protected] >
To: <[email protected]>
Sent: Tuesday, May 19, 2009 11:29 PM
Subject: Re: st: Re: display single value stored in e()


>
>
One minor edit of Martin's response.


//get missings
qui svy linearized : tabulate sex, miss count
mat A=e(Prop)
local mis = round(e(total)*A[3,1])


Should read:

//get missings
qui estpost svy : tabulate sex, miss count
mat A=e(Prop)
local mis = round(e(total)*A[3,1])





Eric

(I apologize if this message is duplicated...my last message was not in plain text)


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/

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index