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

RE: st: sort


From   Richard Williams <[email protected]>
To   [email protected]
Subject   RE: st: sort
Date   Wed, 29 Jun 2005 09:26:56 -0500

At 09:54 AM 6/29/2005 +0100, Nick Cox wrote:
The essence of Florence's problem is that two (or more) variables
be sorted together. How would this -egen- function be used
to achieve that?
Looks like you make repeated calls to the function, e.g.

. webuse auto
(1978 Automobile Data)

. egen xprice = clsort(price)

. egen xmpg = clsort(mpg)

. list price xprice mpg xmpg in 1/5

     +-----------------------------+
     | price   xprice   mpg   xmpg |
     |-----------------------------|
  1. | 4,099     3291    22     12 |
  2. | 4,749     3299    17     12 |
  3. | 3,799     3667    22     14 |
  4. | 4,816     3748    20     14 |
  5. | 7,827     3798    15     14 |
     +-----------------------------+

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX:    (574)288-4373
HOME:   (574)289-5227
EMAIL:  [email protected]
WWW (personal):    http://www.nd.edu/~rwilliam
WWW (department):    http://www.nd.edu/~soc

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