I'm trying to follow what they have listed on the guide here but they don't include the case where one might want to exclude . in their count of unique values.
-
Login or Register
- Log in with
. sysuse auto, clear
(1978 Automobile Data)
. distinct rep78
------------------------------
| total distinct
-------+----------------------
rep78 | 69 5
------------------------------
. distinct rep78, missing
------------------------------
| total distinct
-------+----------------------
rep78 | 74 6
------------------------------
. distinct, sort(distinct)
-------------------------------------
| total distinct
--------------+----------------------
foreign | 74 2
rep78 | 69 5
headroom | 74 8
turn | 74 18
trunk | 74 18
mpg | 74 21
displacement | 74 31
gear_ratio | 74 36
length | 74 47
weight | 74 64
make | 74 74
price | 74 74
-------------------------------------
. distinct, sort(distinct descending)
-------------------------------------
| total distinct
--------------+----------------------
price | 74 74
make | 74 74
weight | 74 64
length | 74 47
gear_ratio | 74 36
displacement | 74 31
mpg | 74 21
trunk | 74 18
turn | 74 18
headroom | 74 8
rep78 | 69 5
foreign | 74 2
-------------------------------------
gen junk=r(ndistinct)
local junk=r(ndistinct)
Comment