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.

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

From |
kokootchke <kokootchke@hotmail.com> |

To |
statalist <statalist@hsphsun2.harvard.edu> |

Subject |
st: Formatting results using -file write- |

Date |
Fri, 13 Aug 2010 04:55:32 -0400 |

Dear all: I am writing some code using the -file write- to create some tables I'd like to use in LaTeX with some specific format. My problem is that I am first saving some means and standard deviations from my data to different scalars, which I then call within the -file write- command, but I cannot get the right format for these numbers. In particular, I want to report means normally, and standard deviations in parentheses. So far, the only thing I've been able to do is to get my standard deviations to look like this in the table: ( X.XX) that is, with one space after the "(". Would anyone know how to get rid of this? If you have some better solution to write a table like this, please let me know! Thank you very much!!Adrian Here is what I do: local varlist "age tenure"foreach var of local varlist{qui su `var' if sample == 1sca `var'_m1 = r(mean) sca `var'_v1 = r(sd)qui su `var' if sample == 2sca `var'_m2 = r(mean) sca `var'_v2 = r(sd)qui su `var' if !femalesca `var'_m3 = r(mean)sca `var'_v3 = r(sd)qui su `var' if femalesca `var'_m4 = r(mean)sca `var'_v4 = r(sd)} file open table1 using table1.tex, write replacefile write table1 "\begin{table}[htbp]\centering" _n ///"\begin{tabular}{lcccccccc}" _n ///"\hline \\" _n ///" & & Full & & Working & & & & \\" _n ///" & & Sample & & Sample & & Males & & Females \\" _n ///"\hline" _n ///"\textit{Worker characteristics} & & & & & & & & \\" _n ///"\quad Age (years) & & " %9.2f (age_m1) " & & " %9.2f (age_m2) " & & " %9.2f (age_m3) " & & " %9.2f (age_m4) " \\" _n ///" & & (" %9.2f (age_v1) ") & & (" %9.2f (age_v2) ") & & (" %9.2f (age_v3) ") & & (" %9.2f (age_v4) ") \\" _n ///"\quad Tenure (years) & & " %9.2f (tenure_m1) " & & " %9.2f (tenure_m2) " & & " %9.2f (tenure_m3) " & & " %9.2f (tenure_m4) " \\" _n ///" & & (" %9.2f (tenure_v1) ") & & (" %9.2f (tenure_v2) ") & & (" %9.2f (tenure_v3) ") & & (" %9.2f (tenure_v4) ") \\" _n ///"\end{tabular}" _n ///"\end{table}" _n /// file close table1 * * 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/

**References**:**st: Getting outreg2 to output variable labels instead of names?***From:*Amar Radia <amarradia@gmail.com>

**st: RE: Getting outreg2 to output variable labels instead of names?***From:*"Sarah Edgington" <sedging@ucla.edu>

**st: RE: Getting outreg2 to output variable labels instead of names?***From:*amarradia <amarradia@gmail.com>

- Prev by Date:
**st: RE: Getting outreg2 to output variable labels instead of names?** - Next by Date:
**st: RE: Getting e(b) from first-stage in ivregress or ivreg2** - Previous by thread:
**st: RE: Getting outreg2 to output variable labels instead of names?** - Next by thread:
**st: RE: Getting outreg2 to output variable labels instead of names?** - Index(es):