Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: tab-delimited output of -tabodds


From   Margaret R Grove <[email protected]>
To   [email protected]
Subject   Re: st: tab-delimited output of -tabodds
Date   Tue, 25 Mar 2008 12:51:30 -0400

Here's a very clunky example of how to get a tab-delimited file of the results of tabodds. Note that if you are doing multiple tabodds commands, using "postfile" with scalars would make this a bit more elegant.


webuse bdesop,clear

tabodds case alcohol [fw=freq]

*** Assign the return codes to variables
gen odds=r(odds)

gen lb_odds=r(lb_odds)

gen ub_odds=r(ub_odds)

gen chi2_hom=r(chi2_hom)

gen p_hom=r(p_hom)

gen df_hom=r(df_hom)

gen chi2_tr=r(chi2_tr)

gen p_trend=r(p_trend)

*** Keep only the first observation

keep if _n==1

*** Fix up p-values for readability

replace p_hom=0.0001 if p_hom<.0001

replace p_trend=0.0001 if p_trend<.0001

*** output the results to a tab-delimited file

outsheet odds lb_odds ub_odds chi2_hom p_hom df_hom chi2_tr p_trend using test.txt, replace

If you don't need all the variables, just use the ones you need.

Meg

Svend Juul wrote:

Herve Stolowy wrote:
Do you know a way to get a tab-delimited file after -tabodds-?
=============================================================
I don't think you can. Some tables are nicely formatted, and highlighting the table, right-clicking, and selecting -copy table- generates a tab-separated file. But -tabodds-
is poorly formatted with the first three columns run together,
and it will not work. To see the formatting, you can paste to Excel and take a look.
StataCorp: It would be a good idea to make a cleaning operation,
i.e., check how the tabular output from various commands are
formatted, and make a consistent formatting for those commands
that don't do it right.
Svend
________________________________________________________ Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 DK-8000 Aarhus C, Denmark Phone, work: +45 8942 6090 Phone, home: +45 8693 7796 Fax: +45 8613 1580 E-mail: [email protected] _________________________________________________________
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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