Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: levelsof for many categories without sorting


From   "Barankay, Iwan T" <itbara@essex.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: levelsof for many categories without sorting
Date   Wed, 7 Sep 2005 10:03:28 +0100

Hi,

I find the command "levelsof" very useful to cut down the time on loops when I run through the category of a variable (e.g. the location_ids of a large survey).

What I also like is that the local macro generated by levlesof is - so it seams to me - still in the order in which it appears in the data and does not sort it which is needed at times (even though the hlp file of levelsof says otherwise). When usually a list is entered into a local it is then sorted.

The problem of course is that there are constraints on levelsof when it hits the character limit.

My question is:

What can I use instead of levelsof for (i) a large number of categories to avoid the character constraint but which (ii) also keeps the categories in the order it appears in the data and does not sort it.

(i) is much more important than (ii) but if someone did an elegant solution for (ii) I would love to hear of it.

Any suggestions would be most welcome.

Yours,

Iwan

_______________________________________
Dr. Iwan Barankay
Department of Economics
University of Essex
Wivenhoe Park
Colchester
CO4 3SQ
U.K.
privatewww.essex.ac.uk/~itbara/


*
*   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/



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