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

Re: st: Getting list of current dataset's variables in order


From   "Jamie Griffin" <Jamie.Griffin@lshtm.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Getting list of current dataset's variables in order
Date   Tue, 11 Oct 2005 15:30:57 +0100

How about:

unab x:_all
[commands that change variables' order]
order `x'

Jamie Griffin.

>>> jcoveney@bigplanet.com 10/11/05 2:22 pm >>>
After altering the variable order, such as with a -merge-, is there an
easy
way to re-order the variables in their original order?  I'm doing it
now in
a round-about way (below).  There must be a more direct way.  I've
looked
through Stata's extended functions and -creturn list-, and searched
with the
keyword _all, but came up empty-handed.  There's probably something
that
I've stared directly at, but didn't see.

Joseph Coveney

program define allem, rclass
    syntax varlist
    return local all `varlist'
end
allem _all
[commands that change variables' order]
order `r(all)'
.
.
.

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