the reason is probably:
sysuse auto
levelsof rep78, local(levs)
local nlev `:word count `levs''
display `nlev'
so returning nlev is redundant
Regards,
Sergiy
On 8/5/08, Jeph Herrin <[email protected]> wrote:
>
> I find -levelsof- very useful, but a while back
> decided it would be more useful if it also returned
> the number of levels.
>
> When I looked at the -ado- file, it seemed like
> a trivial hack; the local macro -nvals- was already
> there, so I just added
>
> return local nvals `nvals'
>
> This seems to work, yet seems much too easy; but
> looking through the code for a reason this
> might sometimes fail, I couldn't find one.
>
> So, my question is, is there a reason -levelsof-
> doesn't return -nvals-? I use it so often, I worry
> that maybe I'm setting myself up for disaster.
>
> thanks,
> Jeph
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/