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

Re: st: Re::tables from smcl


From   "Jesper B. Sorensen" <[email protected]>
To   [email protected]
Subject   Re: st: Re::tables from smcl
Date   Fri, 23 May 2003 20:30:33 -0400

For those who might be interested, I figured out a kludge-y solution using awk (or rather a series of awk's)

awk ' /\{c \|\} \{res\}/ { print $0 }' xx.smcl | awk 'sub(/-/," -") sub(/
\{txt\}/," ") sub(/\{res\}/," ") {print $1, $4, $5, $7}' | awk ' z=$4 z <.05 ? star="*" : star=" ", $4<0.01 ? star="**" : star=star
{printf "%d,%d, %s, %4.3f%s\n%d,%d, %s, (%4.3f)\n",NR, 0, $1, $2, star,NR, 1, "^", $3 }' > xx.txt

I will not make any claims to it being general in any way, but it works for my purposes which involves logits.

Thanks to those who offered their help.

//Jesper



At 01:05 PM 5/23/2003 -0400, you wrote:

Thanks. Stephen Jenkins had a similar suggestion off-list.

I have used parmest/outreg type solutions many times when working on my own machine (I have my own version); the problem in part is that these are not (yet) installed on the restricted-access machine.

The option of cutting and pasting is better than typing, but I was perhaps too greedy in hoping for the existence of a more automated process (it would be a lot of cutting/pasting). For someone proficient in perl, e.g., the task might be relatively trivial, but I don't really know.

Thanks again,
//Jesper


At 05:52 PM 5/23/2003 +0100, you wrote:

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


--
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
Email: [email protected]

Opinions expressed are those of the author, not the institution.

*
* 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/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jesper B. S�rensen
Richard S. Leghorn (1939) Associate Professor of Strategic Management
Sloan School of Management
Massachusetts Institute of Technology
E52-581
Cambridge, MA 02142
http://web.mit.edu/sorensen/www/
(617) 253 7945  -- voice
(617) 253 2660  -- fax


*
*   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/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jesper B. S�rensen
Richard S. Leghorn (1939) Associate Professor of Strategic Management
Sloan School of Management
Massachusetts Institute of Technology
E52-581
Cambridge, MA 02142
http://web.mit.edu/sorensen/www/
(617) 253 7945  -- voice
(617) 253 2660  -- fax


*
*   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