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: RE : RE : st: Super-Columns with Esttab


From   Rebecca Pope <rebecca.a.pope@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: RE : RE : st: Super-Columns with Esttab
Date   Thu, 6 Dec 2012 16:02:12 -0600

Okay, to the scalability of this kind of mess:
"{\trowd\trgaph108\trleft-108\clbrdrt\brdrw10\brdrs\cellx1548\clmgf\clbrdrt\brdrw10\brdrs\cellx3564\clmrg\clbrdrt\brdrw10\brdrs\cellx5580\clmgf\clbrdrt\brdrw10\brdrs\cellx7596\clmrg\clbrdrt\brdrw10\brdrs\cellx9612\pard\intbl\ql{}\cell\pard\intbl\qc{Domestic}\cell\pard\intbl\qc{}\cell\pard\intbl\qc{Foreign}\cell\pard\intbl\qc{}\cell\row}"

Here are my first thoughts. Some of this may miss the mark, but
hopefully it helps.
Obviously, it is best to have Stata generate the -prehead()- text. I
certainly don't trust myself to type it accurately every time. So,
first step, pattern identification:
The first part "{\trowd\trgaph108\trleft-108" and last part "\row}"
are constant, no matter how many dependent variables & models you
have.

"\clbrdrt\brdrw10\brdrs\cellxN" is needed for each cell. N is the
right boundary of the cell. See
http://www.biblioscape.com/rtf15_spec.htm as posted by Sylvain. N is
measured in twips. It is somewhat arbitrary how this is established.
E.g. the -rtfutil- package (Newson, 2012 - see below) lets you specify
how wide you want the columns to be. It looks like -estout- determines
it from the variable widths (first column) and then dividing the rest
of the space by the number of models. I can't figure out what the
total number twips in width is in the code, but I'm sure it's there
since the cells are defined. If our -prehead()- text is going to
result in something that looks decent with the rest of -esttab-
output, we need use -estout-'s method. I think the key is in the part
of the code "MakeRtfRowdefs", but I'd need to study it more to figure
it out.

If we take -estout, pattern()- as a model then the pattern changes to
\clmgf\clbrdrt\brdrw10\brdrs\cellxN if 1
\clmrg\clbrdrt\brdrw10\brdrs\cellxN if 0

Once all of the cells are defined, we start filling them in.
First column:  \pard\intbl\ql{}\cell
Pattern 1 column: pard\intbl\qc{varlabel}\cell
Pattern 0 column: \pard\intbl\qc{}\cell

Sylvain, since you mostly use TeX, I'm going to guess that this is not
a high priority for you. I see this as an interesting thought
experiment, but perhaps beyond the level of effort merited to come up
with a command to create something that just gets passed to -esttab-
or -estout-, particularly when it is relatively easy to merge the
cells in Word.
Naturally though, if Ben Jann sees this post I'd be interested in
knowing how much I would have to bribe him to just slightly modify
-estout- and make our lives a bit easier. ;-)

Newson, R. B. (2012) "From resultssets to resultstables in Stata." The
Stata Journal. 12(2); 191-213.

Cheers,
Rebecca



On Thu, Dec 6, 2012 at 2:03 PM, Rebecca Pope <rebecca.a.pope@gmail.com> wrote:
> Sylvain wrote:
> <snip>
> I have tried something with -prehead()- and -posthead()- instead. The
> following code gives a table quite close to what we are looking for:
>
> esttab dom1 dom2 for1 for2 using test.rtf, append nomtitles nonumber
> posthead("{\trowd\trgaph108\trleft-108\clbrdrt\brdrw10\brdrs\cellx1548\clmgf\clbrdrt\brdrw10\brdrs\cellx3564\clmrg\clbrdrt\brdrw10\brdrs\cellx5580\clmgf\clbrdrt\brdrw10\brdrs\cellx7596\clmrg\clbrdrt\brdrw10\brdrs\cellx9612\pard\intbl\ql{}\cell\pard\intbl\qc{Domestic}\cell\pard\intbl\qc{}\cell\pard\intbl\qc{Foreign}\cell\pard\intbl\qc{}\cell\row}")
>
> Ideally, we would want to use -prehead()- instead of -posthead()- and
> remove the -nonumber- option so as to have the columns numbered below
> the super-columns "Domestic" and "Foreign". However, that corrupts the
> rtf file... (some lines of code are missing at the beginning of the
> file.)
> <snip>
>
> As I understand the -esttab- .ado file, the table is automatically
> defined in "head". However, since the file is written in the order
> "prehead", "head", and "posthead", if you supply text in -prehead()-,
> you also need to give a table definition. The plot thickens...
>
> -prehead()- as specified is already unweildy, so let's start breaking it up.
> local tabdef "{\rtf1\ansi\deff0 {\fonttbl{\f0\fnil Times New
> Roman;}}{\footer\pard\qc\plain\f0\fs24\chpgn\par}"
> local trowd "{\trowd\trgaph108\trleft-108"
> local brdrs "\clbrdrt\brdrw10\brdrs"
> local par "\pard\intbl"
>
> esttab dom1 dom2 for1 for2 using test.rtf, replace nomtitles ///
> prehead("`tabdef'`trowd'`brdrs'\cellx1548\clmgf`brdrs'\cellx3564\clmrg`brdrs'\cellx5580\clmgf`brdrs'\cellx7596\clmrg`brdrs'\cellx9612`par'\ql{}\cell`par'\qc{Domestic}\cell`par'\qc{}\cell`par'\qc{Foreign}\cell`par'\qc{}\cell\row}")
>
> This gets us closer. There are two problems from my perspective. The
> first, as already noted, is that scalability quickly becomes an issue.
> The second is aesthetic - there is a border between the row with the
> supercolumn titles and the row of model numbers.
>
> I think the border is beyond our control. I'll address scaling in another post.
>
> Cheers,
> Rebecca
>
>
> <snip>

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