Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: obtaining chi2 and p-values from crosstabs using estpost and esttab

 From Ángel Rodríguez Laso To statalist@hsphsun2.harvard.edu Subject Re: st: obtaining chi2 and p-values from crosstabs using estpost and esttab Date Tue, 13 Nov 2012 14:17:56 +0100

```tabout varcat using resultados.xls, replace sum svy c(mean varnum ci)
f(2 2) layout(cb) h3(nil) cisep(-) style(tab)

2012/11/13 Colleen Nugent <cnugent@sociology.rutgers.edu>:
> Thank you so much!  I'll give it a try!
>
> I have a similar dilemma for outputting means of different groups and whether they are significantly different.  I'm using:
>
> svy, subpop(subpopname): mean var1, over(var2)
> test [var1]_subpop_1 = [var1]_subpop_2
> test [var1]_subpop_1 = [var1]_subpop_3
>
> I can get esttab or xml_tab to get the means and standard errors output to Excel, but I can't figure out a way of having it add the F-statistic and p-value for the Wald test of significant differences...
>
>
> ----- Original Message -----
> From: "Ángel Rodríguez Laso" <angelrlaso@gmail.com>
> To: statalist@hsphsun2.harvard.edu
> Sent: Tuesday, November 13, 2012 7:48:56 AM
> Subject: Re: st: obtaining chi2 and p-values from crosstabs using estpost and esttab
>
> Colleen,
>
> For crosstabs of complex survey data I use tabout -findit tabout- that
> allows easy output to Excel.
>
> tabout var1 var2 using resultados.xls, replace svy c(row ci) per f(1
> 1) layout(cb) h3(nil) cisep(-) npos(col) style(tab) stats(chi2)
>
> Angel Rodriguez-Laso
>
>
> 2012/11/12 Colleen Nugent <cnugent@sociology.rutgers.edu>:
>> I'm using complex survey data and subpopulations and am running some crosstabs.  I've been successful using estpost and esttab to output these results into Excel, but I am unable to get the chi2 and p-values to carry over into the spreadsheets.  Those cells are labeled but come out blank.  Chi2 and p-values are automatically produced in the output window itself as part of the svy command.  A simple version of my syntax looks like this:
>>
>> estpost svy, subpop(subpopname): tabulate var1 var2, row percent obs
>> esttab using filename.csv, cells("b(f(2))" "obs") append unstack scalars(chi2 p)
>>
>> I've tried throwing in estadd scalar chi2 and estadd chi2 = r(chi2), but those don't seem to help.
>> I've spent a long time sorting through help files for estpost, esttab, estadd, svy, and old Statalist threads and can't seem to find anything that addresses this.  Thanks for any tips that might help me.
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```