Announcement

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

  • Backward compatibility of -distinct- command

    This is to flag a small backward compatibility issue with the super-useful -distinct- command by Nick Cox.

    When doing

    Code:
    distinct varname
    where varname has all missing values, the current version (1.4.1, created on 10 October 2020) of the distinct command displays

    Code:
    note: no distinct values satisfy specification
    It produces no error, and does not define the scalars r(ndistinct) and r(N).

    On the other hand, in a previous version of the command (1.2.1, from 1 March 2012), these were defined, and r(ndistinct) was simply set to zero.

    This inconsistency broke my code recently. Fixing it was easy, but I wanted to flag the problem. My personal preference is for the old behaviour, but perhaps Nick had good reasons to change it?

  • #2
    Odd, I just did
    Code:
    ssc install distinct
    which installed 1.2.1 rather than 1.4.1. Can you tell us where your more recent version came from? Alternatively, uninstall it and reinstall from SSC and apparently you'll get what you want.

    Added in edit: I see now that the later version is posted from the Stata Journal as dm0042_3. So
    Code:
    ado uninstall dm0042_3
    ssc install distinct
    should do the job until Nick updates the SSC version. :-)
    Last edited by William Lisowski; 13 Sep 2021, 09:50.

    Comment


    • #3
      distinct is written by Gary M. Longton. and myself. Thanks for the comments.

      I thjnk I agree that
      r(N) and r(ndistinct) should be returned as 0 in this circumstance.

      Comment


      • #4
        @Nick, just wanted to remind you to fix this in version 1.4.1 of -distinct-, please? The behaviour is inconsistent with the ssc version, which is 1.2.1.

        Comment


        • #5
          Thanks for the reminder.

          Comment

          Working...
          X