Announcement

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

  • Increase the cell width in output with 'tab' command

    Dear Statalisters,

    Is there any way of increasing the cell width of the following output so that the results are not truncated ?


    Code:
     tab journal if id2==1, sort
    
                            Name of Journal |      Freq.     Percent        Cum.
    ----------------------------------------+-----------------------------------
                     Statistics in medicine |         15       35.71       35.71
                                 Biometrics |          7       16.67       52.38
                              Biostatistics |          3        7.14       59.52
    Journal of the American Statistical A.. |          3        7.14       66.67
                        Biometrical Journal |          1        2.38       69.05
              British Journal of Psychiatry |          1        2.38       71.43
                            Clinical trials |          1        2.38       73.81
                             Family process |          1        2.38       76.19
    Health Services & Outcomes Research M.. |          1        2.38       78.57
    Journal of Biopharmaceutical Statistics |          1        2.38       80.95
           Journal of Clinical Epidemiology |          1        2.38       83.33
    Journal of Educational and Behavioral.. |          1        2.38       85.71
    Journal of the Royal Statistical Soci.. |          1        2.38       88.10
    Nephrology Dialysis Transplantation: .. |          1        2.38       90.48
                     Psychological Medicine |          1        2.38       92.86
                      Psychological Methods |          1        2.38       95.24
    Statistical Methods in Medical Research |          1        2.38       97.62
                   The annals of statistics |          1        2.38      100.00
    ----------------------------------------+-----------------------------------
                                      Total |         42      100.00


    'table' command produce better output without truncation but then it does not have sorting option and does not produce percent/cumulative %. Though it can be done by transporting them into Excel but why should one? Any suggestions how to increase the cell width?
    Roman

  • #2
    groups (SSC) will do this, I think. We don't have a data example to play with but try

    Code:
    groups journal if id2==1, order(high)

    Comment


    • #3
      You can use fre.

      Example data:
      Code:
      clear
      input str48 journal
      "Journal of Educational and Behavioral Statistics"
      "Journal of the Royal Statistical Society"       
      end
      Comparison of tab and fre:
      Code:
      . tab journal
      
                                      journal |      Freq.     Percent        Cum.
      ----------------------------------------+-----------------------------------
      Journal of Educational and Behavioral.. |          1       50.00       50.00
      Journal of the Royal Statistical Soci.. |          1       50.00      100.00
      ----------------------------------------+-----------------------------------
                                        Total |          2      100.00
      
      . fre journal, nomiss
      
      journal
      ------------------------------------------------------------------------------------
                                                        |      Freq.    Percent       Cum.
      --------------------------------------------------+---------------------------------
       Journal of Educational and Behavioral Statistics |          1      50.00      50.00
       Journal of the Royal Statistical Society         |          1      50.00     100.00
       Total                                            |          2     100.00           
      ------------------------------------------------------------------------------------

      Comment


      • #4
        Ah.. this is perfect Nick. Thanks a lot.
        Roman

        Comment


        • #5
          Many thanks Friedrich. I guess, my mind was stupidly stuck with 'tab's !!
          Best,

          Correction: 'fre' does not have the sorting option based on frequency as 'group' does. At least in this case, not serving my purpose.
          Last edited by Roman Mostazir; 25 Feb 2016, 11:59. Reason: added correction
          Roman

          Comment


          • #6
            Originally posted by Roman Mostazir View Post
            'fre' does not have the sorting option based on frequency as 'group' does.
            fre can display rows in ascending or descending order of frequency.
            Code:
            clear
            input str48 journal
            "Journal of Educational and Behavioral Statistics"
            "Journal of Educational and Behavioral Statistics"
            "Journal of the Royal Statistical Society"      
            "Journal of the Royal Statistical Society"      
            "Journal of the Royal Statistical Society"      
            end
            Code:
            . fre, nomiss asc
            
            journal
            ------------------------------------------------------------------------------------
                                                              |      Freq.    Percent       Cum.
            --------------------------------------------------+---------------------------------
             Journal of Educational and Behavioral Statistics |          2      40.00      40.00
             Journal of the Royal Statistical Society         |          3      60.00     100.00
             Total                                            |          5     100.00          
            ------------------------------------------------------------------------------------
            
            . fre, nomiss desc
            
            journal
            ------------------------------------------------------------------------------------
                                                              |      Freq.    Percent       Cum.
            --------------------------------------------------+---------------------------------
             Journal of the Royal Statistical Society         |          3      60.00      60.00
             Journal of Educational and Behavioral Statistics |          2      40.00     100.00
             Total                                            |          5     100.00          
            ------------------------------------------------------------------------------------

            Comment


            • #7
              ... Sorry Friedrich. Withdrew my claim.
              Roman

              Comment


              • #8
                Originally posted by Friedrich Huebler View Post
                You can use fre.

                fre journal, nomiss
                "nomiss" option is necessary, if not you would get a short message saying "valid" in the table
                Last edited by Javier Sarmiento; 03 Nov 2016, 20:20.

                Comment

                Working...
                X