Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Making long labels wrap into two lines using esttab on latex

    Hi all,

    I am trying to tabulate some variables and export the data to latex using esttab (command from SSC). Some variables have very long value labels and this causes the data to go outside the table/outside the page.

    I want long variable labels to wrap automatically, but specifying the wrap option is not working. I checked the help for estout and it says " wrap causes long variable labels to be wrapped if space permits and a varwidth() is specified. The wrap option is only useful if several parameter statistics are printed beneath one another and, therefore, white space is available beneath the labels." I have tried specifying varwidth and it did not work. How can this "whitespace" problem be solved from within stata itself?

    As you can see for this variable below, the value labels are pretty long.

    The code I am using is:

    esttab using ****, cell("b(label(Frequency)) pct(fmt (%9.1f) label(Percent)) cumpct(fmt (%9.1f) label(Cumulative))") ///
    nonumber noobs width(\hsize) varwidth(12) wrap varlabels(`e(labels)') title("") append

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte dem_acknowl
    4
    3
    4
    4
    4
    4
    4
    2
    3
    4
    2
    4
    4
    2
    2
    2
    2
    4
    4
    4
    2
    4
    4
    3
    4
    2
    end
    label values dem_acknowl dem_acknowl
    label def dem_acknowl 2 "Written acknowledgement, like a receipt with the date the demand was registered", modify
    label def dem_acknowl 3 "Verbal acknowledgement", modify
    label def dem_acknowl 4 "No acknowledgement", modify

    Thanks for your help!

  • #2
    Hi guys bumping this up, in case anyone has a way to solve this.

    Comment


    • #3
      If you use LaTeX, you can try the following option in esttab:

      Code:
      varlabels(2.dem_acknowl "\multirow{2}{*}{\shortstack{Written acknowledgement, like a receipt with \\ the date the demand was registered}}"
      In LaTeX, you will need the package multirow.
      Last edited by Filip Kostelka; 18 Sep 2021, 03:10.

      Comment

      Working...
      X