Announcement

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

  • Limiting duplicates report

    I wish to show a table with duplicates report, but it is too long. How can I limit the display so that I will be able to see previous output?
    Code:
    duplicates list varname
    Stata/MP 15.1

  • #2
    You should work with a do-file so that you can run it again, commenting out the duplicates list command. Alternatively, recreate the table in your dataset and then browse instead of showing it in the results window. The third option is to enable the results window to hold more results. For this, see https://stats.oarc.ucla.edu/stata/fa...0for%20longer.


    Comment


    • #3
      I am working with a do file. Listing and examining duplicates is not something I do repetitively and IMO needn't be in a .do file. However, my aim is to be able to run this command without the output filling unnecessary space. I think it's a pretty simple and useful thing to have. Many Stata command have an option to shorten output for convenience.
      Stata/MP 15.1

      Comment


      • #4
        Originally posted by Mor Zahavi View Post
        Many Stata command have an option to shorten output for convenience.
        Do you have an example for an official command?

        Comment


        • #5
          You can use -set more on- to require Stata to pause for user input during output.

          Comment


          • #6
            Code:
            list 1/5
            Stata/MP 15.1

            Comment


            • #7
              I would think that you are not listing duplicates randomly and you have some idea of what duplicates you want. For example, if you want to list observations with the highest number of duplicates, you can do something like:

              Code:
              sysuse auto, clear
              bys mpg: gen dup=_N
              qui sum dup, d
              duplicates list mpg if dup>r(p75), sep(0)
              Res.:

              Code:
              .
              . duplicates list mpg if dup>r(p75), sep(0)
              
              Duplicates in terms of mpg
              
                +---------------------+
                | group:   obs:   mpg |
                |---------------------|
                |      1     19    18 |
                |      1     20    18 |
                |      1     21    18 |
                |      1     22    18 |
                |      1     23    18 |
                |      1     24    18 |
                |      1     25    18 |
                |      1     26    18 |
                |      1     27    18 |
                |      2     28    19 |
                |      2     29    19 |
                |      2     30    19 |
                |      2     31    19 |
                |      2     32    19 |
                |      2     33    19 |
                |      2     34    19 |
                |      2     35    19 |
                +---------------------+
              as opposed to all duplicates

              Code:
              duplicates list mpg, sep(0)
              Res.:

              Code:
              . duplicates list mpg, sep(0)
              
              Duplicates in terms of mpg
              
                +---------------------+
                | group:   obs:   mpg |
                |---------------------|
                |      1      1    12 |
                |      1      2    12 |
                |      2      3    14 |
                |      2      4    14 |
                |      2      5    14 |
                |      2      6    14 |
                |      2      7    14 |
                |      2      8    14 |
                |      3      9    15 |
                |      3     10    15 |
                |      4     11    16 |
                |      4     12    16 |
                |      4     13    16 |
                |      4     14    16 |
                |      5     15    17 |
                |      5     16    17 |
                |      5     17    17 |
                |      5     18    17 |
                |      6     19    18 |
                |      6     20    18 |
                |      6     21    18 |
                |      6     22    18 |
                |      6     23    18 |
                |      6     24    18 |
                |      6     25    18 |
                |      6     26    18 |
                |      6     27    18 |
                |      7     28    19 |
                |      7     29    19 |
                |      7     30    19 |
                |      7     31    19 |
                |      7     32    19 |
                |      7     33    19 |
                |      7     34    19 |
                |      7     35    19 |
                |      8     36    20 |
                |      8     37    20 |
                |      8     38    20 |
                |      9     39    21 |
                |      9     40    21 |
                |      9     41    21 |
                |      9     42    21 |
                |      9     43    21 |
                |     10     44    22 |
                |     10     45    22 |
                |     10     46    22 |
                |     10     47    22 |
                |     10     48    22 |
                |     11     49    23 |
                |     11     50    23 |
                |     11     51    23 |
                |     12     52    24 |
                |     12     53    24 |
                |     12     54    24 |
                |     12     55    24 |
                |     13     56    25 |
                |     13     57    25 |
                |     13     58    25 |
                |     13     59    25 |
                |     13     60    25 |
                |     14     61    26 |
                |     14     62    26 |
                |     14     63    26 |
                |     15     64    28 |
                |     15     65    28 |
                |     15     66    28 |
                |     16     68    30 |
                |     16     69    30 |
                |     17     72    35 |
                |     17     73    35 |
                +---------------------+
              
              .

              Comment


              • #8
                What output is it that you want to see? I can't follow what you want here. If the output of duplicates report or duplicates list is awkwardly long, that's because there is a lot to say.

                No one has mentioned duplicates examples.

                Comment


                • #9
                  The output of duplicates list is very long. I thought that there is an option to have something like the head option in Python. duplicates examples yields too much information.
                  Stata/MP 15.1

                  Comment


                  • #10
                    If you want the bare fact of whether there are duplicates, then you are better off with isid which tells you if there are any.

                    Comment

                    Working...
                    X