Announcement

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

  • Is there a way to increase the number of characters shown when tabulating categorical variables?

    I'm dealing with some messy data and before I figure out the best way to clean it, I need some summary statistics. But when I tabulate the categorical variables, the screen cuts the characters of each observation if they have more than a certain number of characters? Is there a way to change the formats so it shows the full observations?

    Thanks,
    Attached Files

  • #2
    The groups command from the Stata Journal is one alternative. The author hijacked a common English word when naming the command (my bad, you may consider) so you need a better way to find the write-up in 2017 and the latest version of the code in 2018. The otherwise unpredictable search term is st0496.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str47 var1
    "very long name which is painful to work with"   
    "yet another example showing limited imagination"
    "short"                                          
    "tiny"                                           
    end
    
    . tab var1
    
                                       var1 |      Freq.     Percent        Cum.
    ----------------------------------------+-----------------------------------
                                      short |          1       25.00       25.00
                                       tiny |          1       25.00       50.00
    very long name which is painful to wo.. |          1       25.00       75.00
    yet another example showing limited i.. |          1       25.00      100.00
    ----------------------------------------+-----------------------------------
                                      Total |          4      100.00
    
    . groups var1
    
      +----------------------------------------------------------------------------+
      |                                            var1   Freq.   Percent      %<= |
      |----------------------------------------------------------------------------|
      |                                           short       1     25.00    25.00 |
      |                                            tiny       1     25.00    50.00 |
      |    very long name which is painful to work with       1     25.00    75.00 |
      | yet another example showing limited imagination       1     25.00   100.00 |
      +----------------------------------------------------------------------------+
    
    .       search st0496, entry
    
    Search of official help files, FAQs, Examples, and Stata Journals
    
    SJ-18-1 st0496_1  . . . . . . . . . . . . . . . . . Software update for groups
            (help groups if installed)  . . . . . . . . . . . . . . . .  N. J. Cox
            Q1/18   SJ 18(1):291
            groups exited with an error message if weights were specified;
            this has been corrected
    
    SJ-17-3 st0496  . . . . .  Speaking Stata: Tables as lists: The groups command
            (help groups if installed)  . . . . . . . . . . . . . . . .  N. J. Cox
            Q3/17   SJ 17(3):760--773
            presents command for listing group frequencies and percents and
            cumulations thereof; for various subsetting and ordering by
            frequencies, percents, and so on; for reordering of columns;
            and for saving tabulated data to new datasets

    Comment


    • #3
      Thank you, Nick. The group output does show the full sentences but sadly my output is so long that I'm unable to view all of it on the screen. Wonder if there's a way to fix that?

      Comment


      • #4
        What's the length of the longest name?

        Comment


        • #5
          The longest is 319 characters but what I meant with I can't view it is that I cannot scroll up long enough to view all of the output. (Sorry not up to date with the lingo) Is there a way to change that?

          Comment


          • #6
            Something has to give there. How much of the default tabulate display do you want?

            Looking at the data in the Editor is one possibility. You can cut down on display of duplicates in various ways. list lets you tune linesize().

            Comment


            • #7
              I cannot scroll up long enough to view all of the output
              See the output of
              Code:
              help scrollbufsize
              to increase the distance the Results window can scroll back. Note that after changing scrollbufsize you have to exit and restart Stata for the new setting to take effect.

              Comment


              • #8
                Thank you both for the help!

                Comment

                Working...
                X