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


From   Rebecca Pope <[email protected]>
To   [email protected]
Subject   Re: RE : st: Super-Columns with Esttab
Date   Tue, 27 Nov 2012 22:42:39 -0600

Sorry, there were two typos in that RTF code...

Here it is corrected:
{\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}
Rebecca



         __o                __o
      _`\ <,_            _`\ <,_
     (_)/   (_)          (_)/   (_)
=========================


On Tue, Nov 27, 2012 at 3:15 PM, Rebecca Pope <[email protected]> wrote:
> Hi Sylvain,
> I don't think -prefix()-, -suffix()-, and -span- are your solution
> unfortunately. As I'm looking at it, it looks like anything you place
> in -prefix()- or -suffix()- will wind up in the cell contents rather
> than as a definition of the cell.
>
> \clmgf & \clmrg (yes, these are correct) have to go in the table
> definition at the begining of the row rather than cell by cell. I'm
> probably explaining this poorly, but I'm _guessing_ you tried
> something like:
>
> esttab dom1 dom2 for1 for2 using test.rtf, nomtitles
> mgroups("Domestic" "Foreign", prefix("\clmgf") suffix("\clmrg") span
> pattern(1 0 1 0))
>
> which generates the following RTF code for the "supercolumns":
> <snip>
> {\trowd\trgaph108\trleft-108\clbrdrt\brdrw10\brdrs\cellx1548\clbrdrt\brdrw10\brdrs\cellx3564\clbrdrt\brdrw10\brdrs\cellx5580\clbrdrt\brdrw10\brdrs\cellx7596\clbrdrt\brdrw10\brdrs\cellx9612\pard\intbl\ql
> {}\cell \pard\intbl\qc {\clmgfDomestic\clmrg}\cell \pard\intbl\qc
> {\clmgfForeign\clmrg}\cell\row}
> <snip>
>
> What you need instead is:
> {\trowd\trgaph108\trleft-108\clbrdrt\brdrw10\brdrs\cellx1548\clmgf\clbrdrt\brdrw10\brdrs\cellx3564\clmrg\clbrdrt\brdrw10\brdrs\clmgr\cellx5580\clbrdrt\brdrw10\brdrs\cellx7596\clbrdrt\brdrw10\brdrs\clmgr\cellx9612\pard\intbl\ql
> {}\cell \pard\intbl\qc {Domestic}\cell \pard\intbl\qc {}\cell
> \pard\intbl\qc {Foreign}\cell \pard\intbl\qc {}\cell\row}
>
> The subtle difference in all that mess is that the RTF merge control
> words go at the beginning of the cell definitions. So, reading left to
> right, we see the first cell defined starting with \clbrdrt & ending
> with \cellx1548. To indicate that we want to start merging with the
> 2nd cell, we need to place \clmgf immediately after that for the
> beginning of the 2nd cell's definition. It ends with \cellx3564.
> Immediately after that, we tell it to merge the 3rd cell with the 2nd.
> Likewise 4th & 5th.
>
> Of course, none of what I'm telling you helps you write this using
> -esttab-. I'm not sure how you would get it to use the cell
> definitions at the beginning of the row. Perhaps something with the
> styles definition? I need to look closer at -estout- and I don't have
> time right now, but I'd be happy to try to work through this with you.
>
> Sorry for the incomplete answer.
>
> Best,
> Rebecca
>
>
> On Fri, Nov 23, 2012 at 6:36 PM, WEBER Sylvain <[email protected]> wrote:
>> Hi,
>> Metoka wants to export tables with super-columns to rtf using -esttab-. The solution proposed by Lance -mgroups("Domestic" "Foreign", pattern(1 0 1 0)- is the best I can think of. However, the result is not absolutely perfect.
>> Here is a restatement of the problem, using the example provided by Ryan Kessler last Monday in a parallel discussion about exporting tables with super-columns to tex (http://www.stata.com/statalist/archive/2012-11/msg00745.html):
>>
>> sysuse auto, clear
>> eststo clear
>> eststo dom1: reg mpg weight if !foreign
>> eststo dom2: reg mpg weight trunk if !foreign
>> eststo for1: reg mpg weight if foreign
>> eststo for2: reg mpg weight trunk if foreign
>> esttab dom1 dom2 for1 for2 using test.tex, booktabs nomtitles mgroups("Domestic" "Foreign", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))
>>
>> This creates a perfect table for latex. But if one exports the same table to rtf (using Lance's solution):
>>
>> esttab dom1 dom2 for1 for2 using test.rtf, nomtitles mgroups("Domestic" "Foreign", pattern(1 0 1 0))
>>
>> There will not be any super column in the table. "Domestic" and "Foreign" will simply appear inside the 2nd and 4th column of the table. One therefore has to merge the cells "manually" inside the rtf file afterwards. That's not a really big deal, but it would be nice to have a solution to automate the entire process of creating rtf tables.
>>
>> I feel that a solution lies in using the -span-, -prefix()-, and -suffix()- label suboptions of -esttab- in combination with rtf control words (\clmgf and \clmrg can apparently be used to merge cells, see: http://www.biblioscape.com/rtf15_spec.htm), but I couldn't reach a solution. All my trials ended in a corrupt rtf files.
>>
>> Thanks for your help.
>>
>> Sylvain
>>
>> Sylvain Weber
>> University of Neuchâtel, Institute of Economic Research (irene)
>> Pierre-à-Mazel 7, 2000 Neuchâtel, Switzerland
>> +41.32.718.14.42
>> [email protected]
>> http://sites.google.com/site/swwebpage/
>> ________________________________________
>> De : [email protected] [[email protected]] de la part de Lance Erickson [[email protected]]
>> Date d'envoi : lundi 19 novembre 2012 10:07
>> À : [email protected]
>> Objet : RE: st: Super-Columns with Esttab
>>
>> The -esttab- command is (what I think they call) a wrapper for -estout- (both commands on SSC by Ben Jann) so the options available for -estout- will work. There is a -mgroups- option that will do what you want if I am understanding your issue correctly.
>>
>> If you have a 4-column matrix the option would be something like...
>>
>> -mgroups("Domestic" "International", pattern(1 0 1 0)-
>>
>> That would put the first super-column label (domestic) over the first two columns and the second super-column label (international) over the third and fourth columns.
>>
>> HTH,
>> Lance
>>
>>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On Behalf Of "Rita Frühwald"
>> Sent: Monday, November 19, 2012 7:06 AM
>> To: [email protected]
>> Subject: Re: st: Super-Columns with Esttab
>>
>> Hi,
>> Thank you for your fast reply, but unfortunately, this solution did not solve my problem. I guess that the problem is that I am trying to add super-columns in a matrix using esttab. To create the several columns of my matrix, I use the stored columns in e() that I can get after I ran the several t-test with estpost. I am not running a regression.
>>
>> The reason why I want to have these supercolumns is that it want to show that the columns N_1 and mu_1 both belong to "Domestic" and that the columns N_2 and mu_2 belong to "Foreign".
>>
>> Isn't there a command in esttab that allows me to add super-columns above my matrix so that I can demonstrate that several columns belong together?
>>
>> Best
>>
>>
>>
>>
>> -------- Original-Nachricht --------
>>> Datum: Sun, 18 Nov 2012 17:02:50 -0500
>>> Von: Ryan Kessler <[email protected]>
>>> An: [email protected]
>>> Betreff: Re: st: Super-Columns with Esttab
>>
>>> You could try using something like this:
>>>
>>> sysuse auto
>>> eststo clear
>>> eststo: reg price foreign
>>> eststo: reg mpg foreign
>>> eststo: reg trunk foreign
>>> esttab, varlabels(foreign "Difference" _cons Domestic) se
>>>
>>> Ryan Kessler
>>>
>>> On Sun, Nov 18, 2012 at 2:15 PM,  <[email protected]> wrote:
>>> > Dear members,
>>> >
>>> > this is my first post, so I hope it works. I am using estpost and
>>> > esttab
>>> to export results from two-sample t-tests in a rtf-file, so that I can
>>> use the output in a word file. I am a stata beginner and also not very
>>> familiar with the estout package.
>>> > I tried to add super-columns above the names of my columns, but I
>>> couldn't figure out how to do it. I hope someone can help me.
>>> >
>>> > So far, my code looks like this:
>>> >
>>> > sysuse auto
>>> > estpost ttest price mpg trunk, by(foreign) esttab using
>>> > "myFileInRtfFormat.rtf", cells("N_1 mu_1 N_2 mu_2 b(star)
>>> se") ///
>>> >         noobs nonumber nomtitle modelwidth(8 8 7 8 8 8) replace
>>> >
>>> > I want to add the super-column "Domestic" above the columnnames N_1
>>> > and
>>> mu_1 (the super-column name "Domestic" should only be shown once), and
>>> I want to add the super-column "Foreign" above the columnnames N_2 and
>>> mu_2 (also just once).
>>> >
>>> > I tried to add the super-columns with the following code:
>>> > equations(1) unstack eqlabels(Domestic Foreign) But only "Domestic"
>>> > is added then.
>>> >
>>> > How can I add Domestic and Foreign above the column names at the
>>> specific positions?
>>> >
>>> >
>>> > Thank you very much for your help!
>>> >
>>> > Metoka
>>> > *
>>> > *   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/
>> *
>> *   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/
>>
>> *
>> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index