Stata | FAQ: Number of distinct observations

PHOTO EMBED

Thu Jun 10 2021 20:24:39 GMT+0000 (Coordinated Universal Time)

Saved by @edwardga

        . sysuse auto, clear
        . by rep78, sort: gen nvals = _n == 1 

count if nvals

content_copyCOPY

https://www.stata.com/support/faqs/data-management/number-of-distinct-observations/