Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: combining tables
Rebecca Pope <firstname.lastname@example.org>
Re: st: combining tables
Tue, 6 Nov 2012 11:20:45 -0600
Thanks again to Nick, Daniel K., and Roger for Stata suggestions. Here
is a summary of my experience with your proposed solutions. It is
pretty dense, but I've tried to be comprehensive in case anyone else
runs into a similar situation since I would say on balance that all
approaches had their relative strengths & weaknesses that different
users might weight differently than I do.
Nick, you were right about -tabout- coming closest to what I want to
accomplish in terms of a single command. Particular strengths in my
context are the ability to have it treat the list of supplied
variables as -tab1- would, rather than producing cross-tabulations or
grouping over all possible combinations of the variables in the list.
This was the problem I ran into with -collapse-. The survey extensions
are also very helpful and, while not applicable in this particular
context, often are in my work. If I'm working with strictly
categorical variables, this would be my command of choice. The
limitation that I have encountered is that I cannot combine continuous
and categorical variables into one table with mean (sd) for continuous
& N (%) for categorical. For an example, see Table 1 of Pyne et al's
How Bad is Depression? Available at
which is a good representation of the sort of table I routinely make
(I can't claim credit for this one, but it is from my group & freely
Next, to Daniel Klein's suggestion about -outreg-. Yes, I know about
John Gallup's -outreg-, but I have almost exclusively used Ben Jann's
-estout- for regression output (Jann B. (2005) Making regression
tables from stored estimates. Stata Journal 5(3): 288–308). I'm not
going to make any claims about one's superiority over the other, just
the relative benefits of familiarity. However, the suggestion about
-outreg-'s extended capabilities prompted me to look a little closer
to home and think more creatively about using -estout- since I'm more
familiar with it. This worked moderately well. The ability to set
numeric formats cell-by-cell is especially nice. Unfortunately, as far
as I can tell, you also lose a lot of options when your matrix is
user-created rather than by Stata-stored estimation results. For
example, it does not appear that you can add parentheses or place one
element under another. All I can say for certain is that I couldn't
when I tried. After this immediate project, I'll look closer at
-outreg- and potentially writing a program that saves the matrix in
r(), which if I'm reading the -estout- documentation correctly should
restore some of the functionality.
Then there is the suite of commands that appear in Roger's article...
If I'd known what I was getting into, I would have waited on this past
my present project too, but once started, I was too stubborn to stop.
The level of control is pretty spectacular and it seems, thus far,
that the main limitations of Roger's approach are the user's & RTF
capabilities (for those who must work in MS Word, etc). Depending on
the the user, this could be quite significant. Two days of trial and
error and another full day spent on many additional readings and I
_finally_ managed to get the RTF output to work correctly. In
fairness, Roger's article does disclose this: "RTF tables are less
simple to produce..." I have a much greater appreciation now for the
commands that do this automatically. In the end though, I wound up
with a table that only requires right indents for the data columns,
the addition of top & bottom borders, and an empty row (personal
preference) above each "gap row" (see -gaprow- in Roger's article).
This is substantially less formatting than I did before, so I'm quite
happy. Still, I'd say the initial time investment to understand all
the intermediate steps was quite high & creating the "resultssets" is
going to require project-specific code rather than invoking a single
command. Given the time that it takes to paste in values & format
tables (especially large ones) in Word, I nevertheless think it is
Once again, thank you to all. I've learned a lot from this exercise.
On Thu, Nov 1, 2012 at 9:30 AM, Rebecca Pope <email@example.com> wrote:
> Thank you to everyone who has responded. I am reviewing all of the
> commands/packages that were suggested. There is a lot to sort through,
> but in the interim, I didn't want you to think I was being ungrateful
> & ignoring your replies.
> On Thu, Nov 1, 2012 at 6:28 AM, Airey, David C
> <firstname.lastname@example.org> wrote:
>> is relevant for the TPL, err Klingon, curious.
>> * 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: