Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Count observations


From   Phil Schumm <pschumm@uchicago.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Count observations
Date   Thu, 27 Jun 2013 12:21:28 -0500

On Jun 27, 2013, at 12:13 PM, Miguel Angel Duran Munoz <maduran@uma.es> wrote:
> Hi, Statalisters. I have a doubt that must have a very simple solution, but I have not been able to find it. I have a variable where some numbers appear more than once. And I would like to know the number of different numbers; ie,  variable = 1 1 1 2 3 4 4 4..., so there are 4 different numbers.


Lots of ways to do it, but -inspect- returns the number of unique values in r(N_unique).  If you want to know what those unique values are, use -levelsof-.


-- Phil


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


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