Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: estabb and rtfutil combination.


From   "Roger B. Newson" <r.newson@imperial.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: estabb and rtfutil combination.
Date   Wed, 13 Feb 2013 12:54:01 +0000

In reply to Amadou's first query, I do not know how to merge (or concatenate) 2 .rtf files. The problem there is that the 2 .rtf files may have different character set declarations, default font declarations, font tables, color tables, stylesheets, info groups, preliminary formatting commands, headers and/or footers, and any proposed concatenation algorithm would have to combine them sensibly. However, I am working on the -rtfappend- module for -rtfutil- as I speak, and this should make life easier, especially for users who want to use both -rtfutil- and -estout-.

In reply to Amadou's second query, I have not produced any tutorials on -listtab- and -rtfutil-. However, -listtab- and -rtfutil- (and -sdecode-) are discussed at length in Newson (2012). If Amadou wants to alternate between landscape and portrait orientation in a single .rtf document, then the -rtfsect- module of -rtfutil- allows the user to do this by inserting section breaks.

In reply to Amadou's third query, I still haven't found out how to override the default resizing of linked graphs in a .rtf document. (I don't know if anybody else has.)

I hope this helps.

Best wishes

Roger

References

Newson RB. From resultssets to resultstables in Stata. The Stata Journal 2012; 12(2): 191–213.

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: r.newson@imperial.ac.uk
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 13/02/2013 07:45, Amadou DIALLO wrote:
Dear Roger,

Many thanks. This is indeed a partial solution to my problem and
definitely, a rtfappend command is most needed and welcome. I wish
this could be released soon!

I also have a couple of questions, to try to find a workaround:

- do you know how to merge 2 rtf files? I googled but cannot find any
proper answer and I don't how to take advantage of the rtf mail merge
tools.

- do you have any tutorial on using rtfutil/listtab with tables, as
the ones available for estout and esttab? The tables I produced using
listtab are messy and the /landscape option I am inserting in my rtf
code is not allowing even to view them in landscape format. The book
by Sean Burke that I bought warned against producing tables in rtf but
is not indeed providing detailed examples, so if anyone can point me
to a good tutorial, that is most welcome.

- is there any way to resize the graphs I am inserting? I know there
have been some discussions around this topic, but am wondering if any
progress has been made on it.

Nonetheless, again thank you for producing rtfutil. It saves me a lot
of time in producing standardized reports for my department.

Warmest regards.

Bachir.

2013/2/12, Roger B. Newson <r.newson@imperial.ac.uk>:
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: r.newson@imperial.ac.uk
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/



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index