[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: saving tables in spreadsheet format
At 09:44 13/09/02 -0400, Guillermo Cruces wrote:
The -outsheet- command creates a generic tab-separated or comma-separated
spreadsheet, with rows corresponding to the observations of the current
data set and columns corresponding to the variables of the current data
set. Therefore, what Guillermo wants to do is probably best done as a
two-step process, where you first create a Stata data set with observations
corresponding to the rows of the table and variables corresponding to the
columns of the table, and then -outsheet- that data set to a generic
I was wondering if there is a program in Stata to output the content of a
into tab or comma separated values (so that it can be open automatically by
Excel or other spreadsheet programs). "outreg" is amazing, but as far as I
it only works with regression output. "outtable" is great too, but it only
converts matrices (and only to Tex).
the "Copy table" option works perfectly, but it is not really convenient
Large tables, b) Large number of tables.
if not available, I could try to write one.
Guillermo doesn't state precisely what kind of table he wants to output.
However, there are many tools in official and unofficial Stata which might
be used to create a Stata data set for output to a generic spreadsheet
using -outsheet-. The -collapse- and -contract- commands are used to create
a Stata data set with 1 observation per by-group and data on frequencies
and summary statistics for that by-group. The -parmest- package
(downloadable from SSC) creates a Stata data set containing regression
output, with 1 observation per parameter of the regression model, or 1
observation per parameter per by-group, and data on confidence intervals,
P-values and other parameter attributes. The -reshape- command reshapes
data sets, and is useful if you want to convert a table with 1 confidence
interval per row to a data set with multiple confidence intervals per row.
I suspect that what Guillermo really wants to do is to output a table of
the kind produced by -tabulate-. The way forward is probably to write a
Stata program which produces an output data set with 1 observation per
table cell and data including cell frequencies, cell percentages, row
percentages and column percentages, and then to use -reshape- to re-arrange
the cells into rows. I might write the required program when I have the
time, unless Guillermo writes it and saves me the trouble.
I hope this helps.
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Opinions expressed are those of the author, not the institution.
* For searches and help try: