Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: "sort" over different variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: "sort" over different variables
Date   Mon, 24 Aug 2009 20:32:20 +0100

Second thoughts: 

You may be asking here for a row sort. If so, see 

SJ-9-1  pr0046  . . . . . . . . . . . . . . . . . . .  Speaking Stata:
Rowwise
        (help rowsort, rowranks if installed) . . . . . . . . . . .  N.
J. Cox
        Q1/09   SJ 9(1):137--157
        shows how to exploit functions, egen functions, and Mata
        for working rowwise; rowsort and rowranks are introduced

for a detailed discussions. The programs introduced are accessible
regardless of whether you have access to recent issues of the Stata
Journal. 

Nick 
n.j.cox@durham.ac.uk 


Nick Cox

This is too simplified and could be any number of things. 

Renaming or re-ordering your variables may be quite enough to solve your
problem. See, e.g., -order-. 

If that doesn't make sense, please explain in more detail what your
problem is. 

Nick 
n.j.cox@durham.ac.uk 

Sim.Oertel@t-online.de

I have a quick (and probably simple) question: I would like to "sort" my
dataset over several variables. At the moment my dataset looks like this
(very simplified example):

Var1   Var2   Var3    Var4 
1000   3000   2000    500

And should look like this:

Var1    Var2    Var3    Var4
500      1000    2000    3000    

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