An advantage of that would be that -inspect-
is part of the executable, so will
run very fast. On the other hand, it does
other things too.
Alternatively, a calculation for
# of distinct values might go something like this:
marksample touse
tempvar unique
bysort `touse' <varlist> :
gen byte `unique' = `touse' * (_n == 1)
su `unique', meanonly
local n_unique = r(sum)
What goes faster? Possibly -inspect-.
Nick
[email protected]
Nick Winter
> You might be able to make good use of the -inspect- command;
> when run on a
> single variable, it seems to leave behind the number of
> unique values in
> r(N_unique)
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/