Statalist


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

st: Counting distinct (not unique) values


From   Dick Campbell <dcamp@uic.edu>
To   "statalist-hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Counting distinct (not unique) values
Date   Sun, 17 Aug 2008 17:24:43 -0500

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:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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