Announcement

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

  • Table with full labels

    Hi friends:

    Someone know how could I show the full labels when I do a simple "tabulate". My labels are so long that when I do a tabulate, the table erase the last word of each label.
    Thanks in advance,
    Oliver


  • #2
    You have no control over the display of labels in -tabulate-. But -tabulate- gives you up to 40 characters worth--which is usually enough to distinguish things clearly. The other -tab- like commands in official Stata (-tabstat-, -table-) have the same limitations, or even smaller. There are some user-written -tab-like commands out there, but I don't use them and don't know if they offer anything better.

    If shortening your labels to 40 characters or less isn't an option, you might consider instead using -contract- to generate a data set that contains the tabulation you want, and then display it with -list-.

    Code:
    sysuse auto, clear
    label define rep78 1 "A special place in the 9th circle of hell" ///
        2 "A complete and total rip-off; never go there again" ///
        3 "Adequate" ///
        4 "Actually OK -- but nothing to write home about" ///
        5 "Best thing since sliced bread; loved it; will buy another one soon"
    label values rep78 rep78
    tab rep78
    
    contract rep78 if !missing(rep78), freq(Freq) percent(Percent) cpercent(Cum) float
    list if !missing(rep78), noobs clean

    Comment


    • #3
      I have just found the "fre" command to be very helpful as an alternative for oneway tabulate.

      Comment


      • #4
        Adrian: fre is from SSC. (You are asked to explain where user-written commands you refer to come from.)

        Another loosely similar command is groups from SSC. I just tested it with Clyde's awkward example. The approach is similar to Clyde's, but not identical.

        Code:
         
        sysuse auto, clear
        label define rep78 1 "A special place in the 9th circle of hell" ///
            2 "A complete and total rip-off; never go there again" ///
            3 "Adequate" ///
            4 "Actually OK -- but nothing to write home about" ///
            5 "Best thing since sliced bread; loved it; will buy another one soon"
        label values rep78 rep78
        
        ssc inst groups 
        groups rep78 
        groups rep78, show(f p)
        Here are the results:

        Code:
         
        . groups rep78 
        
          +-----------------------------------------------------------------------------------------------+
          |                                                              rep78   Freq.   Percent     % <= |
          |-----------------------------------------------------------------------------------------------|
          |                          A special place in the 9th circle of hell       2      2.90     2.90 |
          |                 A complete and total rip-off; never go there again       8     11.59    14.49 |
          |                                                           Adequate      30     43.48    57.97 |
          |                     Actually OK -- but nothing to write home about      18     26.09    84.06 |
          | Best thing since sliced bread; loved it; will buy another one soon      11     15.94   100.00 |
          +-----------------------------------------------------------------------------------------------+
        
        . groups rep78, show(f p) 
        
          +--------------------------------------------------------------------------------------+
          |                                                              rep78   Freq.   Percent |
          |--------------------------------------------------------------------------------------|
          |                          A special place in the 9th circle of hell       2      2.90 |
          |                 A complete and total rip-off; never go there again       8     11.59 |
          |                                                           Adequate      30     43.48 |
          |                     Actually OK -- but nothing to write home about      18     26.09 |
          | Best thing since sliced bread; loved it; will buy another one soon      11     15.94 |
          +--------------------------------------------------------------------------------------+
        There are other options from those shown here, unsurprisingly.

        Comment


        • #5
          Depending on what you want, you could always try

          codebook variable, tab(1000)

          Which would list a longer value label and the frequency.

          Comment

          Working...
          X