Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: -svy- question
From
John Luke Gallup <[email protected]>
To
[email protected]
Subject
Re: st: -svy- question
Date
Fri, 26 Aug 2011 10:55:28 -0600
David,
You can do this -outreg- (since -mean- saves its results in e(b)). -outreg- is an SSC program that you can load with -ssc install outreg, replace-. With the -using- option, the table can be saved to a Word or TeX document with full control of formatting.
Here is an example:
. sysuse auto, clear
(1978 Automobile Data)
. quietly svyset rep78 [pweight=trunk]
. quietly svy: mean mpg weight, over (foreign)
. outreg using wordtbl, stat(b se ci) bdec(1) nosubstat replace ///
> ctitle("","","mean","st.err.","confidence interval")
-----------------------------------------------------------
mean st.err. confidence interval
-----------------------------------------------------------
mpg Domestic 18.7 0.5** 17.3 - 20.1
Foreign 25.0 0.5** 23.5 - 26.4
weight Domestic 3,494.9 68.6** 3,304.3 - 3,685.5
Foreign 2,279.1 101.6** 1,996.9 - 2,561.3
-----------------------------------------------------------
* p<0.05; ** p<0.01
John
On Aug 26, 2011, at 4:03 AM, Nick Cox wrote:
> This is from David Fredericks <[email protected]>
>
>
>
> I am calculating mean household consumption/expenditure and
> constituent parts of household consumption/expenditure like total food
> consumption, and consumption of own produced food.
>
>
>
> I am using the svy command since
>
> 1. the survey design samples about 25% of households;
>
> 2. some of the strata (vuln = vulnerability) groups are somewhat
> under sampled and
>
> 3. the strata have different sampling frequencies (not my design).
>
>
>
> Unfortunately, the output format command is not allowed with the
> “mean” command and “tabstat” is not allowed with “svy”
>
>
>
> As a result my output is not well formatted (Lao Kip is an annoying
> output anyway!!)
>
>
>
> EXAMPLE CODE
>
> svy: mean an_hh_food_totcon an_hh_ownfood_con, over (vuln)
>
>
>
> Over
>
> Mean
>
> Std. Err.
>
> [95% Conf.
>
> Interval]
>
> an_hh_food~n
>
> Vulnerable
>
> 2.31E+07
>
> 1569839
>
> 2.00E+07
>
> 2.61E+07
>
> Poor
>
> 3.31E+07
>
> 1650400
>
> 2.98E+07
>
> 3.63E+07
>
> Average
>
> 3.84E+07
>
> 1535237
>
> 3.54E+07
>
> 4.14E+07
>
> Rich
>
> 4.50E+07
>
> 3259964
>
> 3.86E+07
>
> 5.14E+07
>
> an_hh_ownf~n
>
> Vulnerable
>
> 8626045
>
> 943956.8
>
> 6769295
>
> 1.05E+07
>
> Poor
>
> 9574692
>
> 675307.3
>
> 8246371
>
> 1.09E+07
>
> Average
>
> 1.24E+07
>
> 820947.9
>
> 1.08E+07
>
> 1.40E+07
>
> Rich
>
> 1.82E+07
>
> 1948755
>
> 1.43E+07
>
> 2.20E+07
>
>
>
> I can fix this in excel for final formatting of tables for the report
> but I would love to be able to get the data in better format while I
> run through the analyses.
>
>
>
> Any suggestions? Many thanks in advance.
>
>
>
> ______________________________
>
> David Fredericks
> Development Consultant
> Colombo, Sri Lanka
>
> Skype: david.fredericks
>
> Home/Office: Int [94] 11 276 2274
>
> Mobile: Int [94] .773 571011
>
> ______________________________
>
> *
> * 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/