Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Command to identify number of unique individuals


From   Scott Baldwin <[email protected]>
To   [email protected]
Subject   Re: st: Command to identify number of unique individuals
Date   Mon, 28 Dec 2009 15:29:02 -0700

The "unique" command provides a tabulation of the number of unique
values (see below).

Best,
Scott


. ssc describe unique

---------------------------------------------------------------------------------------------
package unique from http://fmwww.bc.edu/repec/bocode/u
---------------------------------------------------------------------------------------------

TITLE
      'UNIQUE': module to report number of unique values in variable(s)

DESCRIPTION/AUTHOR(S)

      The command unique without a by reports the number of unique
      values for the varlist. With a by it does the same, but also
      creates a new variable (_Unique by default but can be named in
      the gen option). This new variable contains the number of unique
      values of the varlist for each level of the by variable. The new
      variable is coded missing except for the first record in each
      group defined by the levels of the by variable. The command is
      useful for exploring data where the records refer to more than
      one level, for example longitudinal data where each record refers
      to a visit by a subject.

      Author: Tony Brady, Royal Postgraduate Medical School
      Support: email  [email protected]

      Distribution-Date: 19980904

INSTALLATION FILES                               (type net install unique)
      unique.ado
      unique.hlp
---------------------------------------------------------------------------------------------
(type -ssc install unique- to install)


On Mon, Dec 28, 2009 at 11:05 AM, Weichle, Thomas <[email protected]> wrote:
> Hi Statalisters,
> Is there a command that will list the number of unique individuals in my
> dataset?  I'm familiar with the duplicates and dups commands, but these
> aren't showing me the number of unique individuals.
> It should be equivalent to the following SAS command which will identify
> the number of unique observations by study_id:
>
> PROC SORT NODUPKEY DATA=test;
> BY study_id;
> RUN;
>
> Tom Weichle
> Math Statistician
> Center for Management of Complex Chronic Care (CMC3)
> Hines VA Hospital, Bldg 1, C202
> 708-202-8387 ext. 24261
> [email protected]
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index