Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: question about -levelsof-


From   Jeph Herrin <junk@spandrel.net>
To   statalist@hsphsun2.harvard.edu
Subject   st: RE: question about -levelsof-
Date   Wed, 06 Aug 2008 14:30:40 -0400

Nick,

Thanks for the reply (I found this and the others in the
archive, for some reason I did not get any statalist mailings
yesterday).

In response to Sergei & Roger, obviously there's a way to
count the words in a macro. My point was that -levelsof-
*already counts them*, it simply fails to return the number.

Why call another function to do what the first one has already
done? How much overhead is incurred by returning the value?
If the overhead is trivial, it seems easier to add a single line
to -levelsof- than to add a single line many times following
-levelsof-. I long ago did this clone, I was just curious if
there was some reason not to.

Thanks to David for pointing out a utility I didn't know about,
-distinct-.

cheers,
Jeph




Nick Cox wrote:

This question has a historical aspect. I am the original author of
-levelsof-, which grew out of a program called -levels-, which in turn
grew out of a program called -vallist- (which still exists on SSC, under
different management).
So was there a reason for my originally writing it this way? (There is a
separate question, was there a reason for StataCorp not changing it?)
Sergiy and Roger are more confident than I at suggesting what the
reasoning was. Simply, I don't recall. But I guess that if I had been
asked at the time, I would have replied similarly: if you want that too,
it is easy to get it afterwards. I've been much impressed by the Unix
maxim that a program should do just one thing well and occasionally even
followed the precept.
That said, I see no reason why Jeph should not clone -levelsof- and add
this -- nor no strong reason why StataCorp should not add this to
-levelsof-, except for prizing simplicity.
This all underscores the difficulty of history of ideas. The event was
recent, the key personnel are all alive, well and relatively sane, but
very likely no one can reconstruct the exact reasoning.
Nick n.j.cox@durham.ac.uk
*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index