Statalist


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

st: Order variables alphabetically, not like -aorder-


From   "Friedrich Huebler" <[email protected]>
To   [email protected]
Subject   st: Order variables alphabetically, not like -aorder-
Date   Wed, 24 Oct 2007 17:06:19 -0400

Assume I have a dataset with the variables year1, year2, ..., year19, year20.

forval i = 1/20 {
  gen year`i' = 1
}

The command -aorder- sorts the variables in ascending order of the
number that follows "year". The technical note in [D] order explains
that this is by design, "even though to most computer programs, year10
is alphabetically between year1 and year2."

There are cases where I would like the variables to be sorted in
strict alphabetical order, like this:

year1
year10
...
year19
year2
year20
year3
...
year9

Any suggestions on how this can be done without specifying the sort
order with -order-? It would be nice to have an option like -aorder,
strict- that does not try to be as smart as the current version of
-aorder-.

Thanks,

Friedrich
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index