-codebook- is r-class but it doesn't always leave anything behind.
Usually this is good news. See the manual entry
for the full story.
Getting the number of distinct values (presumably what you mean by
unique) was raised in a thread started by
Herve Stolowy only yesterday. Various solutions are discussed at
FAQ . . . . . . . . . . . . . . . . . . . Number of distinct
observations
. . . . . . . . . . . . . . . . . . . . . . . N. J. Cox and G.
Longton
4/02 How do I compute the number of distinct observations?
http://www.stata.com/support/faqs/data/distinct.html
and more could be mentioned. Herve found -distinct- from SSC did what he
wanted.
Luhang Wang
Does anyone know why I get nothing with -return list- after
-codebook-? I did check the ado file of -codebook- and it is an rclass
command. It also seems a series of r() are well defined in the
program.
My purpose is to get the number of unique values of a variable stored
in a scalar or macro. Any suggestion of achieving this, maybe in other
ways, will be appreciated.
*
* 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/