Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re::tables from smcl

From   Roger Newson <>
Subject   st: Re::tables from smcl
Date   Fri, 23 May 2003 17:52:35 +0100

At 12:00 23/05/03 -0400, Jesper B. Sorensen wrote:

In hindsight this is clearly what I should have done, but absent going back overseas and rerunning everything I am now stuck with what I did, which was to make smcl log files. Next time I will be wiser, but at this point it would be faster to type the tables by hand than to make a special trip to rerun models for that purpose (apart from all the other reasons I can't just pop over.) But I would like to avoid typing by hand.

I realize this is an idiosyncratic request, and expect to have to figure it out myself. But Statalist often surprises.
I am assuming that you have access to a text editor, or (failing that) to Microsoft's Word, WordPad or Notepad. If you cannot get the original data emailed across the Atlantic, and do not want to round off decimal places manually (which is probably the worst part of what you seem to be worrying about having to do), then the best thing I can think of is to cut and paste the relevant parts of your smcl logs into Stata do-files between an -input- statement and an -end- statement, and then add a few more Stata programming statements after the -end- statement to output them using -outsheet- to a generic spreadsheet file suitable for input into Word or Excel.

Some packages that might possibly help, and which are downloadable from SSC, are my own -dsconcat- and -listtex- and Nick Cox and Jeremy Wernow's -tostring-. The -dsconcat- package concatenates a list of data sets (eg regression results from different regression models). The -listtex- package outputs a Stata data set, either to the log or to another file, in a delimited format suitable for cutting and pasting as table rows into plain TeX, LaTeX or HTML documents, or into Microsoft Word tables using the menu sequence

Table->Convert->Text to Table

The -tostring- package converts numeric variables to string variables with the same variable names and variable labels. I find that this is very useful if I want to output a Stata data set of estimates, confidence intervals and P-values to a table (using -listtex- or -outsheet-) with parentheses and commas added to the confidence limits, or even stars added to the P-values (which some of my on-statistical colleagues like).

Another time, when you will be wiser, you might want to use the -parmest- package, downloadable from SSC. This saves Stata estimation results as data sets with one observation per parameter, or one observation per parameter per by-group, and data on estimates, standard errors, confidence limits, P-values and other parameter attributes if requested by the user. These can then be plotted and tabulated as the user wishes.

I hope this helps.

Best wishes


Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

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:

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