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

RE: st: sort


From   Richard Williams <Richard.A.Williams.5@ND.edu>
To   statalist@hsphsun2.harvard.edu
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:  Richard.A.Williams.5@ND.Edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index