[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Counting distinct (not unique) values

From   "Nick Cox" <>
To   <>
Subject   st: RE: Counting distinct (not unique) values
Date   Mon, 18 Aug 2008 16:51:55 +0100

Thanks to Kit and Dick for their plugs. 

The program -distinct- from Gary Longton and myself is on SSC. 

The FAQs Kit refers to discuss other solutions we knew about when
writing them. 


Dick Campbell

Thanks to Kit Baum's gentle prodding I did a little more homework
and found -distinct- written by Gary Longton and Nick Cox
a few years ago. It will find the number of distinct values for
every variable in a list, regardless of whether the variable is
string on numeric and leaves behind the count. Thanks to a;;.

My original message

I would like to loop over the list of variables in a data set and
find the number of unique values for each variable, regardless
of whether the variable is numeric or string. There are several
ways to do this for a numeric variable, but I don't see a convenient
way to do it for a mixture of string and numeric variables.

*   For searches and help try:

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