Statalist The Stata Listserver

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

st: Exporting tabstat results to .txt (or other format) files

From   Venable <>
Subject   st: Exporting tabstat results to .txt (or other format) files
Date   Thu, 30 Mar 2006 17:17:54 -0500

Hi -

I use Stata 8.2 for Windows. I would like to export results from
tabstat to .txt files. The format in the Stata Results window, with
the statistics "stacked" over each other, is almost perfect (if I
could put standard deviations in parentheses, that would be perfect),
but copying and pasting is time-consuming and could lead to errors,
plus it makes replication difficult.

The sort of tabstat command I would like to export is

tabstat wheat corn barley, stat(mean sd) by(year) save

I have tried -statsmat- and -tabstatmat-, but neither seems to work
quite right for what I want to do:

-statsmat-: using statsmat as a substitute for tabstat is problematic,
because "by(byvar) is allowed only with a single varname in varlist".
Furthermore, even when you use just one varname, the different
statistics (mean sd in my example) are displayed in columns rather
than one beneath the other (as in tabstat).

-tabstatmat-: this seems to have similar issues - I get a
"conformability error" with multiple varnames in the varlist; with
just one varname in the varlist, the statistics are returned in
separate columns rather than one under the other (this occurs whether
or not I specify columns(variables) in the tabstat command)

I have also tried the -tablemat- command but this allows only one statistic.

The closest thing for what I would like to do seems to be -latabstat-,
which exports beautifully to LaTeX tables - is there something similar
for text files?

Does anyone have any advice? I apologize if this has been discussed
before - I did a quick search of the Statalist archives but did not
find anything addressing these points. Please let me know if I have
overlooked something.

*   For searches and help try:

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