Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: estabb and rtfutil combination.


From   "Roger B. Newson" <[email protected]>
To   [email protected]
Subject   Re: st: estabb and rtfutil combination.
Date   Tue, 12 Feb 2013 12:41:34 +0000

I think the answer is to use -rtfclose- before -esttab-. The -esttab- command is designed to append tables to intact .rtf files that have already been closed. So, in your case, you can write a program like this one:

**** BEGINNING OF CODE - CUT HERE
clear;
sysuse auto;
tempname handle;
rtfopen `handle' using "esttabrtfopenexample.rtf", replace;
file write `handle' _n "{\line}";
file write `handle' _n "{\header\pard\sl360\slmult1\qr\plain\f0\chpgn
  {\i 	\fs20 Auto data analysis} \par}";
eststo tabl: estpost ta rep for;
rtfclose `handle';
esttab tabl using  "esttabrtfopenexample.rtf" , cell(colpct(fmt(2)))
 label noobs varwidth(10) modelwidth(8) addnote("Source: Author")
 append;
**** END OF CODE - CUT HERE

I don't know a way of inserting multiple -esttab- tables into a document produced by -rtfopen-. Perhaps I will add a -rtfappend- command to -rtfutil-.

I hope this helps.

Best wishes

Roger


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

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

On 10/02/2013 12:07, Amadou DIALLO wrote:
Hi,

I'm trying unsuccessfully to combine results produced by 2 different
commands (rtfopen/file and estabb) into a single rtf file. The problem
is that rtfutil is very good at handling text and graphs but I findit
difficult to produce nice tables with desired formatting and
characteristics attributes that I want them to have (which estabb does
very well). Is there a workaround? See sample code below
(esttabrtfopenexample produce blank page while esttabrtfopenexample2
displays tables). Thanks in advance.

clear
sysuse auto
tempname handle
rtfopen `handle' using "esttabrtfopenexample.rtf", replace
file write `handle' _n "{\line}"
file write `handle' _n "{\header\pard\sl360\slmult1\qr\plain\f0\chpgn
{\i 	\fs20 Auto data analysis} \par}"
eststo tabl: estpost ta rep for
esttab tabl using  "esttabrtfopenexample.rtf" , cell(colpct(fmt(2)))
label noobs varwidth(10) modelwidth(8) addnote("Source: Author")
append
esttab tabl using  "esttabrtfopenexample2.rtf" , cell(colpct(fmt(2)))
label noobs varwidth(10) modelwidth(8) addnote("Source: Author")
replace
rtfclose `handle'
exit

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index